Polish gh-1264

This commit is contained in:
Joe Grandja
2023-07-19 11:34:02 -04:00
parent e9b7089ef7
commit 1570a56911
4 changed files with 54 additions and 27 deletions

View File

@@ -1,4 +1,19 @@
package sample.customClaims;
/*
* Copyright 2020-2023 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 sample.customclaims;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

View File

@@ -1,4 +1,19 @@
package sample.customClaims.authorities;
/*
* Copyright 2020-2023 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 sample.customclaims.authorities;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -22,7 +37,7 @@ public class CustomClaimsWithAuthoritiesConfiguration {
UserDetails user = User.withDefaultPasswordEncoder()
.username("user1") // <1>
.password("password")
.roles(new String[] { "user", "admin" }) // <2>
.roles("user", "admin") // <2>
.build();
return new InMemoryUserDetailsManager(user);
}