Browse Source

优化scope

zhouhao 7 years ago
parent
commit
c8a2662329

+ 2 - 4
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-auth-server/src/main/java/org/hswebframework/web/authorization/oauth2/server/support/HttpTokenRequest.java

@@ -29,8 +29,6 @@ import javax.servlet.http.HttpServletRequest;
 import java.util.*;
 
 /**
- * TODO 完成注释
- *
  * @author zhouhao
  */
 public class HttpTokenRequest implements TokenRequest {
@@ -50,8 +48,8 @@ public class HttpTokenRequest implements TokenRequest {
         clientCredentials = getClientCredentials(clientId, clientSecret, authorization);
 
         this.scope = getParameter(OAuth2Constants.scope)
-                .filter(Objects::nonNull)
-                .map(scope -> new HashSet<>(Arrays.asList(scope.split("[, \n]"))))
+                .filter(scopeStr -> !StringUtils.isNullOrEmpty(scopeStr))
+                .map(scopeStr -> new HashSet<>(Arrays.asList(scopeStr.split("[, \n]"))))
                 .orElseGet(HashSet::new);
     }
 

+ 2 - 1
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/GrantType.java

@@ -24,7 +24,8 @@ package org.hswebframework.web.authorization.oauth2.client;
 public interface GrantType {
     String authorization_code = "authorization_code";
     String implicit           = "implicit";
-    String password           = "password";
+    @SuppressWarnings("all")
+    String password = "password";
     String client_credentials = "client_credentials";
     String refresh_token      = "refresh_token";
 }

+ 0 - 2
hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2Constants.java

@@ -19,8 +19,6 @@
 package org.hswebframework.web.authorization.oauth2.client;
 
 /**
- * TODO 完成注释
- *
  * @author zhouhao
  */
 public interface OAuth2Constants {