Selaa lähdekoodia

required = true

zhou-hao 7 vuotta sitten
vanhempi
commit
b9a4d15af3

+ 5 - 1
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2AuthorizeController.java

@@ -19,6 +19,7 @@
 package org.hswebframework.web.authorization.oauth2.controller;
 
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiOperation;
 import org.hswebframework.web.authorization.Authentication;
 import org.hswebframework.web.authorization.annotation.Authorize;
@@ -31,6 +32,7 @@ import org.hswebframework.web.authorization.oauth2.server.support.code.HttpAutho
 import org.hswebframework.web.authorization.oauth2.server.support.implicit.HttpImplicitRequest;
 import org.hswebframework.web.authorization.oauth2.server.support.implicit.ImplicitRequest;
 import org.hswebframework.web.oauth2.core.GrantType;
+import org.hswebframework.web.oauth2.core.OAuth2Constants;
 import org.hswebframework.web.oauth2.model.AuthorizationCodeModel;
 import org.hswebframework.web.oauth2.model.ImplicitAccessTokenModel;
 import org.springframework.web.bind.annotation.*;
@@ -55,6 +57,7 @@ public class OAuth2AuthorizeController {
     @GetMapping(params = "response_type=code")
     @ApiOperation("获取当前登录用户OAuth2.0授权码")
     @Authorize
+    @ApiImplicitParam(paramType = "query",name =  OAuth2Constants.client_id,required = true)
     public AuthorizationCodeModel requestCode(
             @RequestParam("redirect_uri") String redirectUri,
             @RequestParam(value = "state", required = false) String state,
@@ -74,7 +77,8 @@ public class OAuth2AuthorizeController {
 
 
     @GetMapping(params = "response_type=token")
-    @ApiOperation(value = "implicit方式授权",tags = "OAuth2.0-申请token")
+    @ApiOperation(value = "implicit方式授权", tags = "OAuth2.0-申请token")
+    @ApiImplicitParam(paramType = "query",name =  OAuth2Constants.client_id,required = true)
     public ImplicitAccessTokenModel authorizeByImplicit(
             @RequestParam(value = "redirect_uri") String redirect_uri,
             @RequestParam(value = "state") String state,

+ 1 - 1
hsweb-system/hsweb-system-oauth2-server/hsweb-system-oauth2-server-controller/src/main/java/org/hswebframework/web/authorization/oauth2/controller/OAuth2TokenController.java

@@ -55,7 +55,7 @@ public class OAuth2TokenController {
     @ApiOperation(value = "申请token", notes = "具体请求方式请参照: http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html")
     @ApiImplicitParams(
             {
-                    @ApiImplicitParam(paramType = "query", name = OAuth2Constants.client_id),
+                    @ApiImplicitParam(paramType = "query", name = OAuth2Constants.client_id,required = true),
                     @ApiImplicitParam(paramType = "query", name = OAuth2Constants.client_secret),
                     @ApiImplicitParam(paramType = "query", name = OAuth2Constants.refresh_token),
                     @ApiImplicitParam(paramType = "query", name = OAuth2Constants.code),