diff --git a/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranter.java b/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranter.java index a8066145b..cd21aba29 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranter.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/src/main/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranter.java @@ -63,7 +63,7 @@ public class DefaultAuthorizationCodeGranter implements AuthorizationCodeGranter if (StringUtils.isEmpty(scopeStr)) { return ((permission, s) -> false); } - String[] scopes = scopeStr.split("[,]"); + String[] scopes = scopeStr.split("[ ,\n]"); Map> actions = new HashMap<>(); for (String scope : scopes) { String[] permissions = scope.split("[:]"); diff --git a/hsweb-authorization/hsweb-authorization-oauth2/src/test/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranterTest.java b/hsweb-authorization/hsweb-authorization-oauth2/src/test/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranterTest.java index 1f4487b2f..6fe99d62e 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/src/test/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranterTest.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/src/test/java/org/hswebframework/web/oauth2/server/code/DefaultAuthorizationCodeGranterTest.java @@ -19,7 +19,7 @@ public class DefaultAuthorizationCodeGranterTest { @Test public void testPermission() { - BiPredicate predicate = DefaultAuthorizationCodeGranter.createPredicate("user:info,device:query"); + BiPredicate predicate = DefaultAuthorizationCodeGranter.createPredicate("user:info device:query"); { SimplePermission permission=new SimplePermission();