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 Summary
Fields Modifier and Type Field Description static StringAUTO_GRANT_FIELDprotected booleanautoGrantprotected booleanenabledstatic StringENABLED_FIELDprotected Stringidstatic StringID_FIELDprotected static PatternLOCALHOST_PATTERNprotected Stringnamestatic StringNAME_FIELDstatic StringREDIRECT_URI_FIELDstatic StringREDIRECT_URI_SEPARATORprotected List<String>redirectURIsprotected Stringsecretstatic StringSECRET_FIELD
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static OAuth2ClientfromDocumentModel(DocumentModel doc)static DocumentModelfromOAuth2Client(OAuth2Client oAuth2Client)Creates aDocumentModelfrom anOAuth2Client.StringgetId()StringgetName()List<String>getRedirectURIs()StringgetSecret()booleanisAutoGrant()booleanisEnabled()static booleanisRedirectURIValid(String redirectURI)A redirect URI is considered as valid if and only if: It is not empty It starts with https, e.g.booleanisValidWith(String clientId, String clientSecret)static Map<String,Object>toMap(OAuth2Client oAuth2Client)Converts anOAuth2Clientto map structure.StringtoString()static DocumentModelupdateDocument(DocumentModel documentModel, OAuth2Client oAuth2Client)Updates theDocumentModelby theOAuth2Client.
-
-
-
Field Detail
-
NAME_FIELD
public static final String NAME_FIELD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
ID_FIELD
public static final String ID_FIELD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
SECRET_FIELD
public static final String SECRET_FIELD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
REDIRECT_URI_FIELD
public static final String REDIRECT_URI_FIELD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
AUTO_GRANT_FIELD
public static final String AUTO_GRANT_FIELD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
ENABLED_FIELD
public static final String ENABLED_FIELD
- Since:
- 11.1
- See Also:
- Constant Field Values
-
REDIRECT_URI_SEPARATOR
public static final String REDIRECT_URI_SEPARATOR
- Since:
- 11.1
- See Also:
- Constant Field Values
-
LOCALHOST_PATTERN
protected static final Pattern LOCALHOST_PATTERN
-
name
protected String name
-
id
protected String id
-
secret
protected String secret
-
autoGrant
protected boolean autoGrant
- Since:
- 9.10
-
enabled
protected boolean enabled
-
-
Method Detail
-
getName
public String getName()
-
getId
public String getId()
-
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
-
fromOAuth2Client
public static DocumentModel fromOAuth2Client(OAuth2Client oAuth2Client)
Creates aDocumentModelfrom anOAuth2Client.- Parameters:
oAuth2Client- theOAuth2Clientto convert- Returns:
- the
DocumentModelcorresponding to theOAuth2Client - Since:
- 11.1
-
updateDocument
public static DocumentModel updateDocument(DocumentModel documentModel, OAuth2Client oAuth2Client)
Updates theDocumentModelby theOAuth2Client.- Parameters:
documentModel- the document model to updateoAuth2Client- the new values of document- Returns:
- the updated
DocumentModel - Throws:
NullPointerException- if the documentModel or oAuth2Client isnull- Since:
- 11.1
-
toMap
public static Map<String,Object> toMap(OAuth2Client oAuth2Client)
Converts anOAuth2Clientto map structure.- Parameters:
oAuth2Client- theOAuth2Client- Returns:
- a map representing the
OAuth2Client - Since:
- 11.1
-
-