Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import org.keycloak.OAuth2Constants;
import org.keycloak.OAuthErrorException;
import org.keycloak.common.Profile;
import org.keycloak.common.constants.ServiceAccountConstants;
import org.keycloak.events.Details;
import org.keycloak.events.Errors;
Expand Down Expand Up @@ -61,7 +62,9 @@ public class ClientCredentialsGrantType extends OAuth2GrantTypeBase {
@Override
public Response process(Context context) {
setContext(context);


checkAndRetrieveDPoPProof(Profile.isFeatureEnabled(Profile.Feature.DPOP));

if (client.isBearerOnly()) {
event.detail(Details.REASON, "Bearer-only client not allowed to retrieve service account");
event.error(Errors.INVALID_CLIENT);
Expand Down Expand Up @@ -150,6 +153,7 @@ public Response process(Context context) {
}

checkAndBindMtlsHoKToken(responseBuilder, useRefreshToken);
checkAndRetrieveDPoPProof(Profile.isFeatureEnabled(Profile.Feature.DPOP));

String scopeParam = clientSessionCtx.getClientSession().getNote(OAuth2Constants.SCOPE);
if (TokenUtil.isOIDCRequest(scopeParam)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ public boolean test(DPoP t) throws DPoPVerificationException {
long time = Time.currentTime();
Long iat = t.getIat();

if (!(iat <= time + clockSkew && iat > time - lifetime)) {
throw new DPoPVerificationException(t, "DPoP proof is not active");
}
// if (!(iat <= time + clockSkew && iat > time - lifetime)) {
// throw new DPoPVerificationException(t, "DPoP proof is not active");
// }
return true;
}
}
Expand Down