This commit is contained in:
Dmitry Telegin 2024-02-20 04:22:54 +00:00 committed by Pedro Igor
parent 854ec17fd3
commit b81bf85a06
4 changed files with 6 additions and 31 deletions

View file

@ -34,6 +34,7 @@ import org.keycloak.models.RealmModel;
import org.keycloak.provider.Provider; import org.keycloak.provider.Provider;
import org.keycloak.provider.ProviderFactory; import org.keycloak.provider.ProviderFactory;
import org.keycloak.representations.dpop.DPoP; import org.keycloak.representations.dpop.DPoP;
import org.keycloak.services.cors.Cors;
/** /**
* Provider interface for OAuth 2.0 grant types * Provider interface for OAuth 2.0 grant types
@ -85,14 +86,14 @@ public interface OAuth2GrantType extends Provider, ProviderFactory<OAuth2GrantTy
protected HttpHeaders headers; protected HttpHeaders headers;
protected MultivaluedMap<String, String> formParams; protected MultivaluedMap<String, String> formParams;
protected EventBuilder event; protected EventBuilder event;
protected Object cors; protected Cors cors;
protected Object tokenManager; protected Object tokenManager;
protected DPoP dPoP; protected DPoP dPoP;
public Context(KeycloakSession session, RealmModel realm, public Context(KeycloakSession session, RealmModel realm,
ClientModel client, Object clientConfig, ClientConnection clientConnection, Map<String, String> clientAuthAttributes, ClientModel client, Object clientConfig, ClientConnection clientConnection, Map<String, String> clientAuthAttributes,
HttpRequest request, HttpResponse response, HttpHeaders headers, MultivaluedMap<String, String> formParams, HttpRequest request, HttpResponse response, HttpHeaders headers, MultivaluedMap<String, String> formParams,
EventBuilder event, Object cors, Object tokenManager, DPoP dPoP) { EventBuilder event, Cors cors, Object tokenManager, DPoP dPoP) {
this.session = session; this.session = session;
this.realm = realm; this.realm = realm;
this.client = client; this.client = client;

View file

@ -45,34 +45,7 @@ import org.keycloak.saml.common.exceptions.ConfigurationException;
import org.keycloak.saml.common.exceptions.ProcessingException; import org.keycloak.saml.common.exceptions.ProcessingException;
import org.keycloak.saml.common.util.DocumentUtil; import org.keycloak.saml.common.util.DocumentUtil;
import org.keycloak.services.CorsErrorResponseException; import org.keycloak.services.CorsErrorResponseException;
import org.keycloak.services.ServicesLogger;
import org.keycloak.services.Urls;
import org.keycloak.services.clientpolicy.ClientPolicyContext;
import org.keycloak.services.clientpolicy.ClientPolicyException;
import org.keycloak.services.clientpolicy.context.ResourceOwnerPasswordCredentialsContext;
import org.keycloak.services.clientpolicy.context.ResourceOwnerPasswordCredentialsResponseContext;
import org.keycloak.services.clientpolicy.context.ServiceAccountTokenRequestContext;
import org.keycloak.services.clientpolicy.context.ServiceAccountTokenResponseContext;
import org.keycloak.services.clientpolicy.context.TokenRefreshContext;
import org.keycloak.services.clientpolicy.context.TokenRefreshResponseContext;
import org.keycloak.services.clientpolicy.context.TokenRequestContext;
import org.keycloak.services.clientpolicy.context.TokenResponseContext;
import org.keycloak.services.cors.Cors; import org.keycloak.services.cors.Cors;
import org.keycloak.services.managers.AppAuthManager;
import org.keycloak.services.managers.AuthenticationManager;
import org.keycloak.services.managers.AuthenticationSessionManager;
import org.keycloak.services.managers.ClientManager;
import org.keycloak.services.managers.RealmManager;
import org.keycloak.services.managers.UserSessionManager;
import org.keycloak.services.resources.Cors;
import org.keycloak.services.util.AuthorizationContextUtil;
import org.keycloak.services.util.DefaultClientSessionContext;
import org.keycloak.services.util.DPoPUtil;
import org.keycloak.services.util.MtlsHoKTokenUtil;
import org.keycloak.sessions.AuthenticationSessionModel;
import org.keycloak.sessions.RootAuthenticationSessionModel;
import org.keycloak.util.TokenUtil;
import org.keycloak.utils.ProfileHelper;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;

View file

@ -58,7 +58,7 @@ import org.keycloak.services.CorsErrorResponseException;
import org.keycloak.services.ServicesLogger; import org.keycloak.services.ServicesLogger;
import org.keycloak.services.clientpolicy.ClientPolicyContext; import org.keycloak.services.clientpolicy.ClientPolicyContext;
import org.keycloak.services.clientpolicy.ClientPolicyException; import org.keycloak.services.clientpolicy.ClientPolicyException;
import org.keycloak.services.resources.Cors; import org.keycloak.services.cors.Cors;
import org.keycloak.services.util.AuthorizationContextUtil; import org.keycloak.services.util.AuthorizationContextUtil;
import org.keycloak.services.util.DPoPUtil; import org.keycloak.services.util.DPoPUtil;
import org.keycloak.services.util.MtlsHoKTokenUtil; import org.keycloak.services.util.MtlsHoKTokenUtil;
@ -104,7 +104,7 @@ public abstract class OAuth2GrantTypeBase implements OAuth2GrantType {
this.headers = context.headers; this.headers = context.headers;
this.formParams = context.formParams; this.formParams = context.formParams;
this.event = context.event; this.event = context.event;
this.cors = (Cors) context.cors; this.cors = context.cors;
this.tokenManager = (TokenManager) context.tokenManager; this.tokenManager = (TokenManager) context.tokenManager;
this.dPoP = context.dPoP; this.dPoP = context.dPoP;
} }

View file

@ -95,6 +95,7 @@ public class ResourceOwnerPasswordCredentialsGrantType extends OAuth2GrantTypeBa
AuthenticationProcessor processor = new AuthenticationProcessor(); AuthenticationProcessor processor = new AuthenticationProcessor();
processor.setAuthenticationSession(authSession) processor.setAuthenticationSession(authSession)
.setFlowId(flowId) .setFlowId(flowId)
.setFlowPath("token")
.setConnection(clientConnection) .setConnection(clientConnection)
.setEventBuilder(event) .setEventBuilder(event)
.setRealm(realm) .setRealm(realm)