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

The following examples show how to use org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties. 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: DAFramework   Source File: OAuth2Util.java    License: MIT License 6 votes vote down vote up
public static Filter wechat(AuthorizationCodeResourceDetails client, ResourceServerProperties resourceServerProperties, String path, OAuth2ClientContext oauth2ClientContext) {
	OAuth2ClientAuthenticationProcessingFilter oAuth2ClientAuthenticationFilter = new OAuth2ClientAuthenticationProcessingFilter(path);

	OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(client, oauth2ClientContext);
	AuthorizationCodeAccessTokenProvider accessTokenProvider = new AuthorizationCodeAccessTokenProvider();
	accessTokenProvider.setAuthorizationRequestEnhancer((request, resource, form, headers) -> {
		form.set("appid", resource.getClientId());
		form.set("secret", resource.getClientSecret());
		form.set("scope", "snsapi_userinfo");
		form.set("response_type", "code");
		form.set("#wechat_redirect", "");
	});
	accessTokenProvider.setMessageConverters(converters());
	oAuth2RestTemplate.setAccessTokenProvider(accessTokenProvider);

	oAuth2RestTemplate.setRetryBadAccessTokens(true);
	oAuth2ClientAuthenticationFilter.setRestTemplate(oAuth2RestTemplate);

	UserInfoTokenServices tokenServices = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), client.getClientId());
	tokenServices.setRestTemplate(oAuth2RestTemplate);
	oAuth2ClientAuthenticationFilter.setTokenServices(tokenServices);
	return oAuth2ClientAuthenticationFilter;
}
 
Example 2
Source Project: DAFramework   Source File: OAuth2Util.java    License: MIT License 6 votes vote down vote up
public static Filter general(AuthorizationCodeResourceDetails client, ResourceServerProperties resourceServerProperties, String path, OAuth2ClientContext oauth2ClientContext) {
	OAuth2ClientAuthenticationProcessingFilter oAuth2ClientAuthenticationFilter = new OAuth2ClientAuthenticationProcessingFilter(path){
		protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response,
		                                        FilterChain chain, Authentication authResult) throws IOException, ServletException {
			super.successfulAuthentication(request, response, chain, authResult);
			OAuth2AccessToken accessToken = restTemplate.getAccessToken();
			log.warn(new Gson().toJson(authResult));
			log.warn(new Gson().toJson(accessToken));
		}
	};
	OAuth2RestTemplate oAuth2RestTemplate = new OAuth2RestTemplate(client, oauth2ClientContext);
	oAuth2ClientAuthenticationFilter.setRestTemplate(oAuth2RestTemplate);
	UserInfoTokenServices tokenServices = new UserInfoTokenServices(resourceServerProperties.getUserInfoUri(), client.getClientId());
	tokenServices.setRestTemplate(oAuth2RestTemplate);
	oAuth2ClientAuthenticationFilter.setTokenServices(tokenServices);
	return oAuth2ClientAuthenticationFilter;
}
 
Example 3
public OAuth2SecurityConfiguration(ResourceServerProperties resourceServerProperties) {
    this.resourceServerProperties = resourceServerProperties;
}
 
Example 4
public OAuth2TokenServicesConfiguration(ResourceServerProperties resourceServerProperties) {
	this.resourceServerProperties = resourceServerProperties;
}
 
Example 5
public OAuth2TokenServicesConfiguration(ResourceServerProperties resourceServerProperties) {
	this.resourceServerProperties = resourceServerProperties;
}
 
Example 6
public SecurityConfigurer(ResourceServerProperties resourceServerProperties, SecurityProperties securityProperties) {
  this.resourceServerProperties = resourceServerProperties;
  this.securityProperties = securityProperties;
}
 
Example 7
@Bean
public ResourceServerProperties resourceServerProperties() {
	return new ResourceServerProperties(this.credentials.getClientId(), this.credentials.getClientSecret());
}
 
Example 8
protected CustomResourceServer(ResourceServerProperties config) {
	this.config = config;
}
 
Example 9
Source Project: crnk-example   Source File: SpringSecurityConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
public ResourceServerProperties getResource() {
	return resource;
}
 
Example 10
Source Project: springboot-security-wechat   Source File: SecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
public ResourceServerProperties getResource() {
    return resource;
}
 
Example 11
Source Project: movie-db-java-on-azure   Source File: SecurityConfig.java    License: MIT License 4 votes vote down vote up
@Bean
@ConfigurationProperties("facebook.resource")
public ResourceServerProperties facebookResource() {
    return new ResourceServerProperties();
}
 
Example 12
Source Project: DAFramework   Source File: OAuth2ClientResources.java    License: MIT License 4 votes vote down vote up
public ResourceServerProperties getResource() {
	return resource;
}
 
Example 13
Source Project: mojito   Source File: WebSecurityConfig.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
@ConditionalOnProperty(value = "l10n.security.oauth2.enabled", havingValue = "true")
@ConfigurationProperties("l10n.security.oauth2.resource")
public ResourceServerProperties oauth2Resource() {
    return new ResourceServerProperties();
}