Search in sources :

Example 1 with IdentityBrokerState

use of org.keycloak.broker.provider.util.IdentityBrokerState in project keycloak by keycloak.

the class IdentityBrokerService method getAndVerifyAuthenticationSession.

@Override
public AuthenticationSessionModel getAndVerifyAuthenticationSession(String encodedCode) {
    IdentityBrokerState state = IdentityBrokerState.encoded(encodedCode);
    String code = state.getDecodedState();
    String clientId = state.getClientId();
    String tabId = state.getTabId();
    return parseSessionCode(code, clientId, tabId);
}
Also used : IdentityBrokerState(org.keycloak.broker.provider.util.IdentityBrokerState)

Example 2 with IdentityBrokerState

use of org.keycloak.broker.provider.util.IdentityBrokerState in project keycloak by keycloak.

the class IdentityBrokerService method createAuthenticationRequest.

private AuthenticationRequest createAuthenticationRequest(String providerId, ClientSessionCode<AuthenticationSessionModel> clientSessionCode) {
    AuthenticationSessionModel authSession = null;
    IdentityBrokerState encodedState = null;
    if (clientSessionCode != null) {
        authSession = clientSessionCode.getClientSession();
        String relayState = clientSessionCode.getOrGenerateCode();
        encodedState = IdentityBrokerState.decoded(relayState, authSession.getClient().getClientId(), authSession.getTabId());
    }
    return new AuthenticationRequest(this.session, this.realmModel, authSession, this.request, this.session.getContext().getUri(), encodedState, getRedirectUri(providerId));
}
Also used : AuthenticationSessionModel(org.keycloak.sessions.AuthenticationSessionModel) RootAuthenticationSessionModel(org.keycloak.sessions.RootAuthenticationSessionModel) IdentityBrokerState(org.keycloak.broker.provider.util.IdentityBrokerState) AuthenticationRequest(org.keycloak.broker.provider.AuthenticationRequest)

Aggregations

IdentityBrokerState (org.keycloak.broker.provider.util.IdentityBrokerState)2 AuthenticationRequest (org.keycloak.broker.provider.AuthenticationRequest)1 AuthenticationSessionModel (org.keycloak.sessions.AuthenticationSessionModel)1 RootAuthenticationSessionModel (org.keycloak.sessions.RootAuthenticationSessionModel)1