| | |
| | | import org.keycloak.services.managers.ClientSessionCode; |
| | | import org.keycloak.services.managers.ResourceAdminManager; |
| | | import org.keycloak.sessions.AuthenticationSessionModel; |
| | | import org.keycloak.sessions.CommonClientSessionModel; |
| | | |
| | | import javax.ws.rs.core.HttpHeaders; |
| | | import javax.ws.rs.core.Response; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Response authenticated(UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) { |
| | | public Response authenticated(UserSessionModel userSession, ClientSessionContext clientSessionCtx) { |
| | | AuthenticatedClientSessionModel clientSession = clientSessionCtx.getClientSession(); |
| | | ClientSessionCode<AuthenticatedClientSessionModel> accessCode = new ClientSessionCode<>(session, realm, clientSession); |
| | | |
| | | String service = clientSession.getRedirectUri(); |
| | | //TODO validate service |
| | | accessCode.setAction(CommonClientSessionModel.Action.CODE_TO_TOKEN.name()); |
| | | |
| | | String code = accessCode.getOrGenerateCode(); |
| | | KeycloakUriBuilder uriBuilder = KeycloakUriBuilder.fromUri(service); |
| | | uriBuilder.queryParam(TICKET_RESPONSE_PARAM, SERVICE_TICKET_PREFIX + accessCode.getCode()); |
| | | uriBuilder.queryParam(TICKET_RESPONSE_PARAM, SERVICE_TICKET_PREFIX + code); |
| | | |
| | | URI redirectUri = uriBuilder.build(); |
| | | |