Class IdTokenHelper.ClaimsBuilder

java.lang.Object
de.hybris.platform.oauth2.jwt.util.IdTokenHelper.ClaimsBuilder
Enclosing class:
IdTokenHelper

public static class IdTokenHelper.ClaimsBuilder extends Object
The Builder for Claims.
  • Field Details

  • Constructor Details

    • ClaimsBuilder

      public ClaimsBuilder()
  • Method Details

    • iss

      Adds iss (issuer) claim.
      Parameters:
      iss - the issuer
      Returns:
      the claims builder
    • sub

      Adds sub claim.
      Parameters:
      sub - the sub
      Returns:
      the claims builder
    • nonce

      public IdTokenHelper.ClaimsBuilder nonce(String nonce)
      Adds nonce claim.
      Parameters:
      nonce - the nonce
      Returns:
      the claims builder
    • state

      public IdTokenHelper.ClaimsBuilder state(String state)
      Adds state claim.
      Parameters:
      state - the (web) state
      Returns:
      the claims builder
    • setScopes

      public IdTokenHelper.ClaimsBuilder setScopes(String name, List<String> scopes)
      Sets the scopes claim (for a given name).
      Parameters:
      name - the name of the scopes claim (usually should be "scope")
      scopes - the scopes
      Returns:
      the claims builder
    • addScopes

      public IdTokenHelper.ClaimsBuilder addScopes(String name, List<String> scopes)
      Adds the scope to existing scope claim (for a given name).
      Parameters:
      name - the name of the scopes claim (usually should be "scope")
      scopes - the scopes
      Returns:
      the claims builder
    • iat

      Adds the iat claim (using new Date().getTime()).
      Returns:
      the claims builder
    • exp

      public IdTokenHelper.ClaimsBuilder exp(int seconds)
      Adds the exp claim (using new Date().getTime() + seconds * 1000).
      Parameters:
      seconds - after how many seconds should expire
      Returns:
      the claims builder
    • addClaim

      public IdTokenHelper.ClaimsBuilder addClaim(String key, Object value)
      Adds a generic claim.
      Parameters:
      key - the key - name of the claim
      value - the value
      Returns:
      the claims builder
    • getClaims

      public Map<String,Object> getClaims()
      Gets the claims as a map.
      Returns:
      the claims