use of org.apache.cxf.rs.security.oauth2.common.ServerAccessToken in project cxf by apache.
the class AbstractOAuthDataProvider method createAccessToken.
@Override
public ServerAccessToken createAccessToken(AccessTokenRegistration reg) throws OAuthServiceException {
ServerAccessToken at = doCreateAccessToken(reg);
saveAccessToken(at);
if (isRefreshTokenSupported(reg.getApprovedScope())) {
createNewRefreshToken(at);
}
return at;
}
use of org.apache.cxf.rs.security.oauth2.common.ServerAccessToken in project cxf by apache.
the class AbstractOAuthDataProvider method removeClientTokens.
protected void removeClientTokens(Client c) {
List<RefreshToken> refreshTokens = getRefreshTokens(c, null);
if (refreshTokens != null) {
for (RefreshToken rt : refreshTokens) {
revokeRefreshToken(c, rt.getTokenKey());
}
}
List<ServerAccessToken> accessTokens = getAccessTokens(c, null);
if (accessTokens != null) {
for (ServerAccessToken at : accessTokens) {
revokeAccessToken(c, at.getTokenKey());
}
}
}
use of org.apache.cxf.rs.security.oauth2.common.ServerAccessToken in project cxf by apache.
the class AbstractOAuthDataProvider method doCreateNewRefreshToken.
protected RefreshToken doCreateNewRefreshToken(ServerAccessToken at) {
RefreshToken rt = new RefreshToken(at.getClient(), refreshTokenLifetime);
if (at.getAudiences() != null) {
rt.setAudiences(new ArrayList<>(at.getAudiences()));
}
rt.setGrantType(at.getGrantType());
if (at.getScopes() != null) {
rt.setScopes(new ArrayList<>(at.getScopes()));
}
rt.setGrantCode(at.getGrantCode());
rt.setNonce(at.getNonce());
rt.setSubject(at.getSubject());
rt.setClientCodeVerifier(at.getClientCodeVerifier());
return rt;
}
use of org.apache.cxf.rs.security.oauth2.common.ServerAccessToken in project cxf by apache.
the class JPAOAuthDataProviderImpl method createNewAccessToken.
@Override
protected ServerAccessToken createNewAccessToken(Client client, UserSubject userSub) {
ServerAccessToken token = super.createNewAccessToken(client, userSub);
token.setNotBefore((System.currentTimeMillis() / 1000L) - 5L);
return token;
}
use of org.apache.cxf.rs.security.oauth2.common.ServerAccessToken in project cxf by apache.
the class JCacheOAuthDataProviderImpl method createNewAccessToken.
@Override
protected ServerAccessToken createNewAccessToken(Client client, UserSubject userSub) {
ServerAccessToken token = super.createNewAccessToken(client, userSub);
token.setNotBefore((System.currentTimeMillis() / 1000L) - 5L);
return token;
}
Aggregations