OAuth2AuditAccessTokenContextProvider.java revision 5b2db69e215078c268a3e690d144373baebbf17b
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2015-2016 ForgeRock AS.
*/
/**
* A provider which provides user id and context details for auditing purposes. This provider draws its details
* from an OAuth2 {@link AccessToken} if one is available.
*
* @since 13.0.0
*/
public class OAuth2AuditAccessTokenContextProvider extends OAuth2AuditOAuth2TokenContextProvider {
private final TokenStore tokenStore;
/**
* Create a new instance of OAuth2AuditAccessTokenContextProvider, which will use the supplied {@link TokenStore},
* {@link OAuth2RequestFactory}.
*
* @param tokenStore The helper to use for reading authentication JWTs.
* @param requestFactory The factory for creating OAuth2Request instances.
*/
this.tokenStore = tokenStore;
this.requestFactory = requestFactory;
}
/**
* {@inheritDoc}
*/
return userId;
}
return userId;
}
return null;
}
/**
* {@inheritDoc}
*/
if (trackingId != null) {
return trackingId;
}
if (trackingId != null) {
return trackingId;
}
return null;
}
/**
* {@inheritDoc}
*/
public TrackingIdKey getTrackingIdKey() {
return OAUTH2_ACCESS;
}
if (accessToken != null) {
}
return userId;
}
if (accessToken != null) {
}
return userId;
}
if (accessToken != null) {
}
return trackingId;
}
if (accessToken != null) {
}
return trackingId;
}
if (challengeResponse == null) {
return null;
}
return null;
}
try {
return null;
}
return token;
}
return token;
}
}