use of org.springframework.security.oauth2.provider.token.AccessTokenConverter in project theskeleton by codenergic.
the class SecurityConfig method accessTokenConverter.
@Bean
public AccessTokenConverter accessTokenConverter(UserService userService) {
DefaultAccessTokenConverter accessTokenConverter = new DefaultAccessTokenConverter();
accessTokenConverter.setUserTokenConverter(new UserAccessTokenAuthenticationConverter());
return accessTokenConverter;
}
use of org.springframework.security.oauth2.provider.token.AccessTokenConverter in project theskeleton by codenergic.
the class SecurityConfig method jwtAccessTokenConverter.
/**
* Token converter and enhancer
* @return
*/
@Bean
public JwtAccessTokenConverter jwtAccessTokenConverter(AccessTokenConverter accessTokenConverter) {
JwtAccessTokenConverter tokenConverter = new JwtAccessTokenConverter();
tokenConverter.setAccessTokenConverter(accessTokenConverter);
return tokenConverter;
}
use of org.springframework.security.oauth2.provider.token.AccessTokenConverter in project spring-security-oauth by spring-projects.
the class CheckTokenEndpointTest method setUp.
@Before
public void setUp() {
ResourceServerTokenServices resourceServerTokenServices = mock(ResourceServerTokenServices.class);
OAuth2AccessToken accessToken = mock(OAuth2AccessToken.class);
OAuth2Authentication authentication = mock(OAuth2Authentication.class);
when(resourceServerTokenServices.readAccessToken(anyString())).thenReturn(accessToken);
when(accessToken.isExpired()).thenReturn(false);
when(accessToken.getValue()).thenReturn("access-token-1234");
when(resourceServerTokenServices.loadAuthentication(accessToken.getValue())).thenReturn(authentication);
this.checkTokenEndpoint = new CheckTokenEndpoint(resourceServerTokenServices);
AccessTokenConverter accessTokenConverter = mock(AccessTokenConverter.class);
when(accessTokenConverter.convertAccessToken(accessToken, authentication)).thenReturn(new HashMap());
this.checkTokenEndpoint.setAccessTokenConverter(accessTokenConverter);
}
use of org.springframework.security.oauth2.provider.token.AccessTokenConverter in project openlmis-stockmanagement by OpenLMIS.
the class ResourceServerSecurityConfiguration method remoteTokenServices.
/**
* RemoteTokenServices bean initializer.
*
* @param checkTokenUrl url to check tokens against
* @param clientId client's id
* @param clientSecret client's secret
* @return token services
*/
@Bean
@Autowired
public RemoteTokenServices remoteTokenServices(@Value("${auth.server.url}") String checkTokenUrl, @Value("${auth.server.clientId}") String clientId, @Value("${auth.server.clientSecret}") String clientSecret) {
final RemoteTokenServices remoteTokenServices = new RemoteTokenServices();
remoteTokenServices.setCheckTokenEndpointUrl(checkTokenUrl);
remoteTokenServices.setClientId(clientId);
remoteTokenServices.setClientSecret(clientSecret);
remoteTokenServices.setAccessTokenConverter(accessTokenConverter());
return remoteTokenServices;
}
use of org.springframework.security.oauth2.provider.token.AccessTokenConverter in project flytecnologia-api by jullierme.
the class FlyAutorizationServerConfig method configure.
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception {
TokenEnhancerChain tokenEnhancerChain = new TokenEnhancerChain();
tokenEnhancerChain.setTokenEnhancers(Arrays.asList(tokenEnhancer(), jwtAccessTokenConverter));
endpoints.tokenStore(tokenStore()).tokenEnhancer(tokenEnhancerChain).authenticationManager(authenticationManager).accessTokenConverter(jwtAccessTokenConverter).reuseRefreshTokens(false);
/* endpoints
.tokenStore(tokenStore())
.accessTokenConverter(jwtAccessTokenConverter)
.reuseRefreshTokens(false)
.authenticationManager(authenticationManager);*/
}
Aggregations