Class OAuth2CodeParser

java.lang.Object
org.keycloak.protocol.oidc.utils.OAuth2CodeParser

public class OAuth2CodeParser extends Object
Author:
Marek Posolda
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    parseCode(org.keycloak.models.KeycloakSession session, String code, org.keycloak.models.RealmModel realm, org.keycloak.events.EventBuilder event)
    Will parse the code and retrieve the corresponding OAuth2Code and AuthenticatedClientSessionModel.
    static String
    persistCode(org.keycloak.models.KeycloakSession session, org.keycloak.models.AuthenticatedClientSessionModel clientSession, OAuth2Code codeData)
    Will persist the code to the cache and return the object with the codeData and code correctly set

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • OAuth2CodeParser

      public OAuth2CodeParser()
  • Method Details

    • persistCode

      public static String persistCode(org.keycloak.models.KeycloakSession session, org.keycloak.models.AuthenticatedClientSessionModel clientSession, OAuth2Code codeData)
      Will persist the code to the cache and return the object with the codeData and code correctly set
      Returns:
      code parameter to be used in OAuth2 handshake
    • parseCode

      public static OAuth2CodeParser.ParseResult parseCode(org.keycloak.models.KeycloakSession session, String code, org.keycloak.models.RealmModel realm, org.keycloak.events.EventBuilder event)
      Will parse the code and retrieve the corresponding OAuth2Code and AuthenticatedClientSessionModel. Will also check if code wasn't already used and if it wasn't expired. If it was already used (or other error happened during parsing), then returned parser will have "isIllegalCode" set to true. If it was expired, the parser will have "isExpired" set to true