Class OAuth2Client

java.lang.Object
org.nuxeo.ecm.platform.oauth2.clients.OAuth2Client

public class OAuth2Client extends Object
Since:
5.9.2
Author:
Arnaud Kervern
  • Field Details

  • Constructor Details

    • OAuth2Client

      protected OAuth2Client(String name, String id, String secret, List<String> redirectURIs, boolean autoGrant, boolean enabled)
      Since:
      9.10
  • Method Details

    • getName

      public String getName()
    • getId

      public String getId()
    • getRedirectURIs

      public List<String> getRedirectURIs()
      Since:
      9.2
    • isAutoGrant

      public boolean isAutoGrant()
      Since:
      9.10
    • isEnabled

      public boolean isEnabled()
    • getSecret

      public String getSecret()
      Since:
      11.1
    • fromDocumentModel

      public static OAuth2Client fromDocumentModel(DocumentModel doc)
    • isRedirectURIValid

      public static boolean isRedirectURIValid(String redirectURI)
      A redirect URI is considered as valid if and only if:
      • It is not empty
      • It starts with https, e.g. https://my.redirect.uri
      • It doesn't start with http, e.g. nuxeo://authorize
      • It starts with http://localhost with localhost not part of the domain name, e.g. http://localhost:8080/nuxeo, a counter-example being http://localhost.somecompany.com
      • The Nuxeo node is in Dev mode
      Since:
      9.2
    • isValidWith

      public boolean isValidWith(String clientId, String clientSecret)
    • fromOAuth2Client

      public static DocumentModel fromOAuth2Client(OAuth2Client oAuth2Client)
      Creates a DocumentModel from an OAuth2Client.
      Parameters:
      oAuth2Client - the OAuth2Client to convert
      Returns:
      the DocumentModel corresponding to the OAuth2Client
      Since:
      11.1
    • updateDocument

      public static DocumentModel updateDocument(DocumentModel documentModel, OAuth2Client oAuth2Client)
      Updates the DocumentModel by the OAuth2Client.
      Parameters:
      documentModel - the document model to update
      oAuth2Client - the new values of document
      Returns:
      the updated DocumentModel
      Throws:
      NullPointerException - if the documentModel or oAuth2Client is null
      Since:
      11.1
    • toMap

      public static Map<String,Object> toMap(OAuth2Client oAuth2Client)
      Converts an OAuth2Client to map structure.
      Parameters:
      oAuth2Client - the OAuth2Client
      Returns:
      a map representing the OAuth2Client
      Since:
      11.1
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Since:
      9.2