This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class AppConfig { | |
@Bean | |
@ConfigurationProperties("provider") | |
public ProviderInfo providerInfo() { | |
return new ProviderInfo(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class AppConfig { | |
// Using SpEL | |
@Value("#{providerInfo.name ?: 'bar'}") | |
private String providerName; | |
// Injecting a Duration w/ a default | |
@Value("${timeout:500ms}") | |
private Duration timeout; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component | |
@ConfigurationProperties("provider") | |
public class ProviderInfo { | |
private String name; | |
private boolean enabled; | |
private List<String> roles; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
private PrincipalExtractor principalExtractor; | |
private Filter ssoFilter() { | |
OAuth2ClientAuthenticationProcessingFilter facebookFilter = new OAuth2ClientAuthenticationProcessingFilter("/login/facebook"); | |
OAuth2RestTemplate facebookTemplate = new OAuth2RestTemplate(facebook(), oauth2ClientContext); | |
facebookFilter.setRestTemplate(facebookTemplate); | |
UserInfoTokenServices tokenServices = new UserInfoTokenServices(facebookResource().getUserInfoUri(), facebook().getClientId()); | |
tokenServices.setRestTemplate(facebookTemplate); | |
tokenServices.setPrincipalExtractor(principalExtractor); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Autowired | |
private FacebookPrincipalExtractor facebookPrincipalExtractor; | |
@Autowired | |
private FacebookAuthoritiesExtractor facebookAuthoritiesExtractor; | |
@Autowired | |
private GooglePrincipalExtractor googlePrincipalExtractor; | |
@Autowired | |
private GoogleAuthoritiesExtractor googleAuthoritiesExtractor; | |
@Bean |
OlderNewer