Fix check build issues
This commit is contained in:
parent
926f4a75ba
commit
141605cb24
|
@ -1,3 +1,19 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2002-2018 the original author or authors.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
package org.springframework.security.oauth2.core;
|
package org.springframework.security.oauth2.core;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -9,12 +25,17 @@ import org.springframework.security.authorization.AuthorityAuthorizationManager;
|
||||||
*/
|
*/
|
||||||
public class ScopeAuthorizationManagerFactory {
|
public class ScopeAuthorizationManagerFactory {
|
||||||
|
|
||||||
|
private ScopeAuthorizationManagerFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
public static <T> AuthorityAuthorizationManager<T> hasScope(String scope) {
|
public static <T> AuthorityAuthorizationManager<T> hasScope(String scope) {
|
||||||
return AuthorityAuthorizationManager.hasAuthority("SCOPE_" + scope);
|
return AuthorityAuthorizationManager.hasAuthority("SCOPE_" + scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> AuthorityAuthorizationManager<T> hasAnyScope(String... scopes) {
|
public static <T> AuthorityAuthorizationManager<T> hasAnyScope(String... scopes) {
|
||||||
String[] mappedScopes = Arrays.stream(scopes).map(s -> "SCOPE_" + s).toArray(String[]::new);
|
String[] mappedScopes = Arrays.stream(scopes).map(s -> {
|
||||||
|
return "SCOPE_" + s;
|
||||||
|
}).toArray(String[]::new);
|
||||||
return AuthorityAuthorizationManager.hasAnyAuthority(mappedScopes);
|
return AuthorityAuthorizationManager.hasAnyAuthority(mappedScopes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue