Java Code Examples for org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor

The following examples show how to use org.springframework.boot.autoconfigure.security.oauth2.resource.AuthoritiesExtractor. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-boot-samples   Source File: SecurityConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public AuthoritiesExtractor authoritiesExtractor() {
	return map -> {
		String username = (String) map.get("login");
		if (this.cfpProperties.getSecurity().getAdmins().contains(username)) {
			return AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER,ROLE_ADMIN");
		}
		else {
			return AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER");
		}
	};
}
 
Example 2
@Bean
public AuthoritiesExtractor authoritiesExtractor() {
    return new SimpleAuthoritiesExtractor(OAUTH2_AUTHORITIES_ATTRIBUTE);
}
 
Example 3
@Bean
public AuthoritiesExtractor authoritiesExtractor() {
    return new SimpleAuthoritiesExtractor(OAUTH2_AUTHORITIES_ATTRIBUTE);
}
 
Example 4
@Bean
public AuthoritiesExtractor authoritiesExtractor() {
    return new SimpleAuthoritiesExtractor(OAUTH2_AUTHORITIES_ATTRIBUTE);
}
 
Example 5
@Bean
public AuthoritiesExtractor authoritiesExtractor() {
    return new SimpleAuthoritiesExtractor(OAUTH2_AUTHORITIES_ATTRIBUTE);
}
 
Example 6
public void setAuthoritiesExtractor(AuthoritiesExtractor authoritiesExtractor) {
    Assert.notNull(authoritiesExtractor, "AuthoritiesExtractor must not be null");
    this.authoritiesExtractor = authoritiesExtractor;
}
 
Example 7
Source Project: DAFramework   Source File: CustomUserInfoTokenServices.java    License: MIT License 4 votes vote down vote up
public void setAuthoritiesExtractor(AuthoritiesExtractor authoritiesExtractor) {
	this.authoritiesExtractor = authoritiesExtractor;
}
 
Example 8
public void setAuthoritiesExtractor(AuthoritiesExtractor authoritiesExtractor) {
    this.authoritiesExtractor = authoritiesExtractor;
}
 
Example 9
Source Project: tutorials   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
@Profile("oauth2-extractors-baeldung")
public AuthoritiesExtractor baeldungAuthoritiesExtractor() {
    return new BaeldungAuthoritiesExtractor();
}
 
Example 10
Source Project: tutorials   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
@Profile("oauth2-extractors-github")
public AuthoritiesExtractor githubAuthoritiesExtractor() {
    return new GithubAuthoritiesExtractor();
}