@Override public void saveAccountInfo(OidcKeycloakAccount account) { RefreshableKeycloakSecurityContext securityContext = (RefreshableKeycloakSecurityContext)account.getKeycloakSecurityContext(); CookieTokenStore.setTokenCookie(deployment, facade, securityContext); }
public DropwizardBearerTokenFilterImpl(KeycloakDeployment keycloakDeployment) { deploymentContext = new AdapterDeploymentContext(keycloakDeployment); nodesRegistrationManagement = new NodesRegistrationManagement(); } }
public ApplicationBuilder(AdapterConfig config) { this.deployment = KeycloakDeploymentBuilder.build(config); this.deploymentContext = new AdapterDeploymentContext(deployment); }
@Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (!deployment.isConfigured()) { return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } nodesRegistrationManagement.tryRegister(deployment); RequestAuthenticator authenticator = createRequestAuthenticator(deployment, exchange, securityContext, facade); return keycloakAuthenticate(exchange, securityContext, authenticator); }
/** * Checks that access token is still valid. Will attempt refresh of token if it is not. * * @param request */ protected void checkKeycloakSession(Request request, HttpFacade facade) { KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); AdapterTokenStore tokenStore = getTokenStore(request, facade, deployment); tokenStore.checkCurrentToken(); }
@Override public void logout() { KeycloakPrincipal<RefreshableKeycloakSecurityContext> principal = CookieTokenStore.getPrincipalFromCookie(deployment, facade, this); if (principal == null) return; CookieTokenStore.removeCookie(deployment, facade); }
protected void beforeStop() { if (nodesRegistrationManagement != null) { nodesRegistrationManagement.stop(); } }
public AuthOutcome authenticate(HttpFacade exchange) { if(!deployment.isOAuthQueryParameterEnabled()) { return AuthOutcome.NOT_ATTEMPTED; } tokenString = null; tokenString = getAccessTokenFromQueryParamter(exchange); if (tokenString == null || tokenString.trim().isEmpty()) { challenge = challengeResponse(exchange, OIDCAuthenticationError.Reason.NO_QUERY_PARAMETER_ACCESS_TOKEN, null, null); return AuthOutcome.NOT_ATTEMPTED; } return (authenticateToken(exchange, tokenString)); }
public static void invokeRegisterNode(KeycloakDeployment deployment, String host) throws HttpFailure, IOException { String registerNodeUrl = deployment.getRegisterNodeUrl(); invokeClientManagementRequest(deployment, host, registerNodeUrl); }
public static void invokeUnregisterNode(KeycloakDeployment deployment, String host) throws HttpFailure, IOException { String unregisterNodeUrl = deployment.getUnregisterNodeUrl(); invokeClientManagementRequest(deployment, host, unregisterNodeUrl); }
@Override protected AuthChallenge challengeResponse(HttpFacade facade, Reason reason, String error, String description) { this.validationFailureDescription = description; return super.challengeResponse(facade, reason, error, description); } }
@Override public void setVerifyTokenAudience(boolean verifyTokenAudience) { delegate.setVerifyTokenAudience(verifyTokenAudience); } }
public void initializeKeycloak() { KeycloakDeployment kd = KeycloakDeploymentBuilder.build(adapterConfig); deploymentContext = new AdapterDeploymentContext(kd); }
@Override public AuthenticationMechanismOutcome authenticate(HttpServerExchange exchange, SecurityContext securityContext) { UndertowHttpFacade facade = createFacade(exchange); KeycloakDeployment deployment = deploymentContext.resolveDeployment(facade); if (!deployment.isConfigured()) { return AuthenticationMechanismOutcome.NOT_ATTEMPTED; } nodesRegistrationManagement.tryRegister(deployment); RequestAuthenticator authenticator = createRequestAuthenticator(deployment, exchange, securityContext, facade); return keycloakAuthenticate(exchange, securityContext, authenticator); }
public DropwizardBearerTokenFilterImpl(KeycloakDeployment keycloakDeployment) { deploymentContext = new AdapterDeploymentContext(keycloakDeployment); nodesRegistrationManagement = new NodesRegistrationManagement(); } }
@Override public void saveAccountInfo(OidcKeycloakAccount account) { RefreshableKeycloakSecurityContext secContext = (RefreshableKeycloakSecurityContext)account.getKeycloakSecurityContext(); CookieTokenStore.setTokenCookie(deployment, facade, secContext); }
@Override public void saveAccountInfo(OidcKeycloakAccount account) { RefreshableKeycloakSecurityContext securityContext = (RefreshableKeycloakSecurityContext)account.getKeycloakSecurityContext(); CookieTokenStore.setTokenCookie(deployment, facade, securityContext); }
@Override public void saveAccountInfo(OidcKeycloakAccount account) { RefreshableKeycloakSecurityContext securityContext = (RefreshableKeycloakSecurityContext)account.getKeycloakSecurityContext(); CookieTokenStore.setTokenCookie(deployment, facade, securityContext); }
@Override public void saveAccountInfo(OidcKeycloakAccount account) { RefreshableKeycloakSecurityContext securityContext = (RefreshableKeycloakSecurityContext)account.getKeycloakSecurityContext(); CookieTokenStore.setTokenCookie(deployment, facade, securityContext); }
@Override public void saveAccountInfo(OidcKeycloakAccount account) { RefreshableKeycloakSecurityContext secContext = (RefreshableKeycloakSecurityContext)account.getKeycloakSecurityContext(); CookieTokenStore.setTokenCookie(deployment, facade, secContext); }