List of usage examples for org.springframework.security.oauth2.common.util SerializationUtils deserialize
public static <T> T deserialize(byte[] byteArray)
From source file:oauth2.entities.RefreshToken.java
public OAuth2RefreshToken getToken() { return SerializationUtils.deserialize(token); }
From source file:oauth2.entities.AccessToken.java
public OAuth2AccessToken getToken() { return SerializationUtils.deserialize(token); }
From source file:oauth2.entities.AccessToken.java
public OAuth2Authentication getAuthentication() { return SerializationUtils.deserialize(authentication); }
From source file:org.openmhealth.shim.AccessParameterClientTokenServices.java
@Override public OAuth2AccessToken getAccessToken(OAuth2ProtectedResourceDetails resource, Authentication authentication) { String username = authentication.getPrincipal().toString(); String shimKey = authentication.getDetails().toString(); AccessParameters accessParameters = accessParametersRepo.findByUsernameAndShimKey(username, shimKey, new Sort(Sort.Direction.DESC, "dateCreated")); if (accessParameters == null || accessParameters.getSerializedToken() == null) { return null; //No token was found! }// w w w. j ava 2s. com return SerializationUtils.deserialize(accessParameters.getSerializedToken()); }
From source file:com.epam.reportportal.auth.store.OAuth2MongoTokenStore.java
@Override public OAuth2Authentication readAuthentication(String tokenId) { return SerializationUtils .deserialize(oAuth2AccessTokenRepository.findByTokenId(tokenId).getAuthentication()); }
From source file:com.epam.reportportal.auth.store.OAuth2MongoTokenStore.java
@Override public OAuth2AccessToken readAccessToken(String tokenValue) { OAuth2AccessTokenEntity token = oAuth2AccessTokenRepository.findByTokenId(tokenValue); if (token == null) { return null; //let spring security handle the invalid token }/*from w w w.j a v a2 s . c o m*/ return SerializationUtils.deserialize(token.getToken()); }
From source file:com.cedac.security.oauth2.provider.code.MongoAuthorizationCodeServices.java
public OAuth2Authentication remove(String code) { OAuth2Authentication authentication = null; DBObject query = new BasicDBObject(codeFieldName, code); DBObject authCode = getAuthCodeCollection().findOne(query); if (authCode != null) { authentication = SerializationUtils.deserialize((byte[]) authCode.get(authenticationFieldName)); if (authentication != null) { getAuthCodeCollection().remove(authCode); }// www .jav a 2 s. c o m } return authentication; }
From source file:com.epam.reportportal.auth.store.OAuth2MongoTokenStore.java
@Override public OAuth2AccessToken getAccessToken(OAuth2Authentication authentication) { OAuth2AccessTokenEntity token = oAuth2AccessTokenRepository .findByAuthenticationId(authenticationKeyGenerator.extractKey(authentication)); return token == null ? null : SerializationUtils.deserialize(token.getToken()); }
From source file:com.epam.reportportal.auth.store.OAuth2MongoTokenStore.java
private OAuth2AccessToken extractAccessToken(OAuth2AccessTokenEntity token) { return (OAuth2AccessToken) SerializationUtils.deserialize(token.getToken()); }
From source file:org.openmhealth.shim.OAuth2ShimBase.java
protected OAuth2RestOperations restTemplate(String stateKey, String code) { DefaultAccessTokenRequest existingRequest = stateKey != null && authorizationRequestParametersRepo.findByStateKey(stateKey) != null ? (DefaultAccessTokenRequest) SerializationUtils.deserialize( authorizationRequestParametersRepo.findByStateKey(stateKey).getSerializedRequest()) : null;/*from w w w. j ava 2 s. co m*/ if (existingRequest != null && code != null) { existingRequest.set("code", code); } DefaultOAuth2ClientContext context = new DefaultOAuth2ClientContext( existingRequest != null ? existingRequest : new DefaultAccessTokenRequest()); if (existingRequest != null) { context.setPreservedState(stateKey, "NONE"); } OAuth2RestTemplate restTemplate = new OAuth2RestTemplate(getResource(), context); AccessTokenProviderChain tokenProviderChain = new AccessTokenProviderChain( new ArrayList<>(Arrays.asList(getAuthorizationCodeAccessTokenProvider()))); tokenProviderChain.setClientTokenServices(new AccessParameterClientTokenServices(accessParametersRepo)); restTemplate.setAccessTokenProvider(tokenProviderChain); return restTemplate; }