From 141605cb2451a425dda61f07a34643f6f34cb8c8 Mon Sep 17 00:00:00 2001 From: Mario Petrovski Date: Fri, 1 Sep 2023 14:11:01 +0200 Subject: [PATCH] Fix check build issues --- .../ScopeAuthorizationManagerFactory.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ScopeAuthorizationManagerFactory.java b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ScopeAuthorizationManagerFactory.java index a11787c6a7..0f1c0c9829 100644 --- a/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ScopeAuthorizationManagerFactory.java +++ b/oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ScopeAuthorizationManagerFactory.java @@ -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; import java.util.Arrays; @@ -9,12 +25,17 @@ import org.springframework.security.authorization.AuthorityAuthorizationManager; */ public class ScopeAuthorizationManagerFactory { + private ScopeAuthorizationManagerFactory() { + } + public static AuthorityAuthorizationManager hasScope(String scope) { return AuthorityAuthorizationManager.hasAuthority("SCOPE_" + scope); } public static AuthorityAuthorizationManager 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); } }