List of usage examples for org.springframework.security.oauth2.common OAuth2RefreshToken getValue
@JsonValue String getValue();
From source file:com.tlantic.integration.authentication.service.security.TokenStoreService.java
@Override public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken) { Query query = new Query(); query.addCriteria(Criteria.where("refreshToken").is(refreshToken.getValue())); OAuth2AuthenticationAccessToken token = mongoTemplate.findOne(query, OAuth2AuthenticationAccessToken.class, "oauth2_access_token"); if (token != null) { oAuth2AccessTokenRepository.delete(token); }//from w ww . j a v a2s.c om }
From source file:oauth2.authentication.tokens.TokenServiceImpl.java
@Override public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken) { AccessToken entity = accessTokenRepository.findByRefreshToken(refreshToken.getValue()); if (entity != null) { accessTokenRepository.delete(entity); }/* ww w .java 2 s . co m*/ }
From source file:com.haulmont.restapi.auth.ClientProxyTokenStore.java
@Override public void removeRefreshToken(OAuth2RefreshToken token) { serverTokenStore.removeRefreshToken(token.getValue()); }
From source file:oauth2.authentication.tokens.TokenServiceImpl.java
@Override public void storeRefreshToken(OAuth2RefreshToken refreshToken, OAuth2Authentication authentication) { RefreshToken entity = new RefreshToken(); entity.setTokenId(extractTokenKey(refreshToken.getValue())); entity.setToken(refreshToken);//from w w w. ja va 2s . c o m entity.setAuthentication(authentication); refreshTokenRepository.save(entity); }
From source file:com.haulmont.restapi.auth.ClientProxyTokenStore.java
@Override public void removeAccessTokenUsingRefreshToken(OAuth2RefreshToken refreshToken) { serverTokenStore.removeAccessTokenUsingRefreshToken(refreshToken.getValue()); }
From source file:com.acc.conv.Oauth2AccessTokenConverter.java
@Override public void marshal(final Object source, final HierarchicalStreamWriter writerOrig, final MarshallingContext context) { final OAuth2AccessToken token = (OAuth2AccessToken) source; final ExtendedHierarchicalStreamWriter writer = (ExtendedHierarchicalStreamWriter) writerOrig .underlyingWriter();// w w w . ja v a2s .c om writer.startNode(OAuth2AccessToken.ACCESS_TOKEN, String.class); writer.setValue(formattedValue(token.getValue())); writer.endNode(); writer.startNode(OAuth2AccessToken.TOKEN_TYPE, String.class); writer.setValue(formattedValue(token.getTokenType())); writer.endNode(); final OAuth2RefreshToken refreshToken = token.getRefreshToken(); if (refreshToken != null) { writer.startNode(OAuth2AccessToken.REFRESH_TOKEN, String.class); writer.setValue(formattedValue(refreshToken.getValue())); writer.endNode(); } final Date expiration = token.getExpiration(); if (expiration != null) { final long now = System.currentTimeMillis(); writer.startNode(OAuth2AccessToken.EXPIRES_IN, Integer.class); writer.setValue(String.valueOf((expiration.getTime() - now) / 1000)); writer.endNode(); } final Set<String> scope = token.getScope(); if (scope != null && !scope.isEmpty()) { final StringBuffer scopes = new StringBuffer(); for (final String s : scope) { Assert.hasLength(s, "Scopes cannot be null or empty. Got " + scope); scopes.append(s); scopes.append(' '); } writer.startNode(OAuth2AccessToken.SCOPE, String.class); writer.setValue(formattedValue(scopes.substring(0, scopes.length() - 1))); writer.endNode(); } final Map<String, Object> additionalInformation = token.getAdditionalInformation(); for (final String key : additionalInformation.keySet()) { writer.startNode(key, String.class); writer.setValue(formattedValue(String.valueOf(additionalInformation.get(key)))); writer.endNode(); } }
From source file:com.github.biegleux.gae.oauth.tokenstore.GaeTokenStore.java
@Override public void removeRefreshToken(OAuth2RefreshToken token) { removeRefreshToken(token.getValue()); }
From source file:com.nagarro.core.oauth2.token.provider.HybrisOAuthTokenStore.java
@Override public void removeRefreshToken(final OAuth2RefreshToken token) { removeRefreshToken(token.getValue()); }
From source file:com.haulmont.restapi.auth.ClientProxyTokenStore.java
@Override public OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token) { byte[] authenticationBytes = serverTokenStore.getAuthenticationByRefreshTokenValue(token.getValue()); return authenticationBytes != null ? SerializationUtils.deserialize(authenticationBytes) : null; }
From source file:com.github.biegleux.gae.oauth.tokenstore.GaeTokenStore.java
@Override public OAuth2Authentication readAuthenticationForRefreshToken(OAuth2RefreshToken token) { return readAuthenticationForRefreshToken(token.getValue()); }