org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor Java Examples
The following examples show how to use
org.springframework.boot.autoconfigure.security.oauth2.resource.PrincipalExtractor.
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 File: SecurityConfig.java From spring-boot-samples with Apache License 2.0 | 6 votes |
@Bean public PrincipalExtractor principalExtractor(GithubClient githubClient, UserRepository userRepository) { return map -> { String githubLogin = (String) map.get("login"); User speaker = userRepository.findByGithub(githubLogin); if (speaker == null) { logger.info("Initialize user with githubId {}", githubLogin); GithubUser user = githubClient.getUser(githubLogin); speaker = new User(); speaker.setEmail(user.getEmail()); speaker.setName(user.getName()); speaker.setGithub(githubLogin); speaker.setAvatarUrl(user.getAvatar()); userRepository.save(speaker); } return speaker; }; }
Example #2
Source File: OAuth2SecurityConfiguration.java From flair-registry with Apache License 2.0 | 4 votes |
@Bean public PrincipalExtractor principalExtractor() { return new SimplePrincipalExtractor(OAUTH2_PRINCIPAL_ATTRIBUTE); }
Example #3
Source File: OAuth2TokenServicesConfiguration.java From okta-jhipster-microservices-oauth-example with Apache License 2.0 | 4 votes |
@Bean public PrincipalExtractor principalExtractor() { return new SimplePrincipalExtractor(OAUTH2_PRINCIPAL_ATTRIBUTE); }
Example #4
Source File: OAuth2TokenServicesConfiguration.java From okta-jhipster-microservices-oauth-example with Apache License 2.0 | 4 votes |
@Bean public PrincipalExtractor principalExtractor() { return new SimplePrincipalExtractor(OAUTH2_PRINCIPAL_ATTRIBUTE); }
Example #5
Source File: OAuth2TokenServicesConfiguration.java From okta-jhipster-microservices-oauth-example with Apache License 2.0 | 4 votes |
@Bean public PrincipalExtractor principalExtractor() { return new SimplePrincipalExtractor(OAUTH2_PRINCIPAL_ATTRIBUTE); }
Example #6
Source File: MyUserInfoTokenServices.java From springboot-security-wechat with Apache License 2.0 | 4 votes |
public void setPrincipalExtractor(PrincipalExtractor principalExtractor) { Assert.notNull(principalExtractor, "PrincipalExtractor must not be null"); this.principalExtractor = principalExtractor; }
Example #7
Source File: OAuth2SsoClientAutoContextConfig.java From onetwo with Apache License 2.0 | 4 votes |
@Bean public PrincipalExtractor userDetailPrincipalExtractor(){ return new UserDetailPrincipalExtractor(); }
Example #8
Source File: SecurityConfig.java From tutorials with MIT License | 4 votes |
@Bean @Profile("oauth2-extractors-baeldung") public PrincipalExtractor baeldungPrincipalExtractor() { return new BaeldungPrincipalExtractor(); }
Example #9
Source File: SecurityConfig.java From tutorials with MIT License | 4 votes |
@Bean @Profile("oauth2-extractors-github") public PrincipalExtractor githubPrincipalExtractor() { return new GithubPrincipalExtractor(); }
Example #10
Source File: ResourceServerConfig.java From springcloud-oauth2 with MIT License | 2 votes |
/** * 自定义Principal提取器,返回的Principal是一个map * * @return */ @Bean public PrincipalExtractor principalExtractor() { return new CustomizePrincipalExtractor(); }