Skip to content

Commit

Permalink
address comments on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
PasinduLakshan99 committed May 6, 2024
1 parent e08bc9e commit 27c6d0b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ public class DPoPJKTCacheKey implements Serializable {

private String cacheKeyString;

private static final long serialVersionUID = 5023478840178742769L;

public DPoPJKTCacheKey(String clientId, String authzCode) {

this.cacheKeyString = clientId + ":" + authzCode;
}

private static final long serialVersionUID = 5023478840178742769L;
public String getCacheKeyString() {

return cacheKeyString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class DPoPConstants {
public static final String DPOP_ACCESS_TOKEN_HASH = "ath";
public static final String DPOP_JWT_TYPE = "dpop+jwt";
public static final String DPOP_TOKEN_TYPE = "DPoP";
public static final String EXPIRED_DPOP_PROOF = "Expired DPoP Proof";
public static final String INVALID_DPOP_PROOF = "invalid_dpop_proof";
public static final String INVALID_DPOP_ERROR = "Invalid DPoP Proof";
public static final String INVALID_CLIENT = "invalid_client";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.wso2.carbon.identity.oauth2.IdentityOAuth2Exception;

/**
* Data Access Object Interface for DPoP JKT
* Data Access Object Interface for DPoP JKT.
*/
public interface DPoPJKTDAO {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.wso2.carbon.identity.event.IdentityEventException;
import org.wso2.carbon.identity.event.event.Event;
import org.wso2.carbon.identity.event.handler.AbstractEventHandler;
import org.wso2.carbon.identity.oauth.cache.OAuthCache;
import org.wso2.carbon.identity.oauth.cache.SessionDataCache;
import org.wso2.carbon.identity.oauth.cache.SessionDataCacheEntry;
import org.wso2.carbon.identity.oauth.cache.SessionDataCacheKey;
Expand Down Expand Up @@ -75,7 +74,7 @@ public void handleEvent(Event event) throws IdentityEventException {
DPoPJKTDAOImpl dpopJKTDAO = new DPoPJKTDAOImpl();
dpopJKTDAO.insertDPoPJKT(consumerKey, codeId, dpopJkt);
// Persist dpop_jkt in the cache
if (OAuthCache.getInstance().isEnabled()) {
if (DPoPJKTCache.getInstance().isEnabled()) {
DPoPJKTCacheKey dPoPJKTCacheKey = new DPoPJKTCacheKey(consumerKey,
dpopJKTDAO.getAuthzCodeFromCodeId(codeId));
DPoPJKTCacheEntry dPoPJKTCacheEntry = new DPoPJKTCacheEntry(dpopJkt);
Expand All @@ -87,7 +86,7 @@ public void handleEvent(Event event) throws IdentityEventException {
}
}
} catch (InvalidOAuthClientException | IdentityOAuth2Exception e) {
log.error("Error while persisting dpop_jkt in the DB for the client id : " + consumerKey, e);
log.error("Error while persisting dpop_jkt for the client id : " + consumerKey, e);
throw new IdentityEventException(DPoPConstants.INVALID_CLIENT, DPoPConstants.INVALID_CLIENT_ERROR);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public class DPoPServiceComponent {
protected void activate(ComponentContext context) {


//TODO: Remove true and replace with the actual table check
boolean isAvailableTable = true; //&& IdentityDatabaseUtil.isTableExists(DPOP_JKT_TABLE_NAME);
//TODO: Remove false and replace with the actual table check
boolean isAvailableTable = false; //IdentityDatabaseUtil.isTableExists(DPOP_JKT_TABLE_NAME);
if (log.isDebugEnabled()) {
log.debug(DPOP_JKT_TABLE_NAME + " table is " + (isAvailableTable ? " " : "not ") + "available" +
"Setting isDPoPJKTTableEnabled to " + isAvailableTable);
Expand Down

0 comments on commit 27c6d0b

Please sign in to comment.