Interface OAuthServerDescription
-
public interface OAuthServerDescription
The description of an OAuth authentication server- Since:
- 4.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
OAuthServerDescription.Singleton
cache for registered instances
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CLIENT_ID
Key of the client-id propertystatic java.lang.String
CLIENT_SECRET
Key of the client-secret propertystatic boolean
OAUTH_CONNECTION
if oauth.connection plugin is loadedstatic java.lang.String
USE_OAUTH_CONNECTION
Key if the setting from 'oauth.connection' plugin is used
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static OAuthServerDescription
get(java.lang.String name)
FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cachejava.lang.String
getAuthenticationURL(com.inet.authentication.AuthenticationDescription config)
The URL of the authentication redirect without parameters.default java.lang.String
getAuthenticationURL(com.inet.authentication.AuthenticationDescription config, java.lang.String redirectURL, java.lang.String state)
Add the needed parameters to the authentication redirect URL.default java.io.InputStream
getAvatar(java.lang.String accessToken)
Alternative method to request the avatar icon.default java.lang.String
getColor(java.util.Map<java.lang.String,java.lang.String> settings)
Get the color as hex value, e.g.default java.net.URLConnection
getDataConnection(com.inet.authentication.AuthenticationDescription config, java.lang.String accessToken)
Get the URLConnection for user information.default java.lang.String
getIconURL(java.util.Map<java.lang.String,java.lang.String> settings)
Get the Icon resource URL.default java.lang.String
getLoginDisplayName(java.lang.String email, java.lang.String givenName, java.lang.String familyName, java.lang.String alternativeLoginID)
Get the display name of the login in the user manager.default java.lang.String
getOauthConnectionProvider()
Get the name of the related OauthConnectionProvider from the 'oauth.connection' plugin.default java.lang.String
getScope(com.inet.authentication.AuthenticationDescription config)
Get the scope value.default java.lang.String
getTokenData(com.inet.authentication.AuthenticationDescription config, java.lang.String redirectURL, java.lang.String code)
The POST data to verify the login from the serverjava.lang.String
getTokenURL(com.inet.authentication.AuthenticationDescription config)
The POST URL to verify the login from the server.default boolean
hasOauthConnectionSettings()
If this provider has related settings in the 'oauth.connection' plugin.default boolean
isTrustAllCerificates(com.inet.authentication.AuthenticationDescription config)
Use the authentication server a private certificate and we should trust all certificates.java.lang.String
name()
Get the loginSource/name for this server.
-
-
-
Field Detail
-
CLIENT_ID
static final java.lang.String CLIENT_ID
Key of the client-id property- See Also:
- Constant Field Values
-
CLIENT_SECRET
static final java.lang.String CLIENT_SECRET
Key of the client-secret property- See Also:
- Constant Field Values
-
USE_OAUTH_CONNECTION
static final java.lang.String USE_OAUTH_CONNECTION
Key if the setting from 'oauth.connection' plugin is used- See Also:
- Constant Field Values
-
OAUTH_CONNECTION
static final boolean OAUTH_CONNECTION
if oauth.connection plugin is loaded
-
-
Method Detail
-
get
static OAuthServerDescription get(@Nonnull java.lang.String name)
FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cache- Parameters:
name
- the name- Returns:
- OAuthServerDescription or null
- Since:
- 23.10
-
name
@Nonnull java.lang.String name()
Get the loginSource/name for this server.- Returns:
- the login source
- Since:
- 4.0
-
getColor
@Nullable default java.lang.String getColor(@Nullable java.util.Map<java.lang.String,java.lang.String> settings)
Get the color as hex value, e.g. "#ff00ee". If null the default color is used.- Parameters:
settings
- the settings in the configuration manager- Returns:
- the color
- Since:
- 21.4
-
getIconURL
@Nullable default java.lang.String getIconURL(@Nullable java.util.Map<java.lang.String,java.lang.String> settings)
Get the Icon resource URL. If null the default Icon is used.- Parameters:
settings
- the settings in the configuration manager- Returns:
- the url
- Since:
- 21.4
-
getScope
@Nonnull default java.lang.String getScope(@Nonnull com.inet.authentication.AuthenticationDescription config)
Get the scope value. The scope are the data which we want grand access.- Parameters:
config
- the current oauth configuration- Returns:
- the scope parameter
- Since:
- 4.0
-
getAuthenticationURL
@Nonnull java.lang.String getAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config)
The URL of the authentication redirect without parameters. This is the first URL to which the browser will be redirect.- Parameters:
config
- the current configuration- Returns:
- the URL
- Since:
- 4.0
-
getAuthenticationURL
@Nonnull default java.lang.String getAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config, java.lang.String redirectURL, java.lang.String state)
Add the needed parameters to the authentication redirect URL.- Parameters:
config
- the current oauth configurationredirectURL
- the return URL of this serverstate
- a random state which need to verify later- Returns:
- the URL
- Since:
- 4.0
-
getTokenURL
java.lang.String getTokenURL(@Nonnull com.inet.authentication.AuthenticationDescription config)
The POST URL to verify the login from the server.- Parameters:
config
- the current oauth configuration- Returns:
- the URL
- Since:
- 4.0
-
getTokenData
@Nonnull default java.lang.String getTokenData(@Nonnull com.inet.authentication.AuthenticationDescription config, java.lang.String redirectURL, java.lang.String code)
The POST data to verify the login from the server- Parameters:
config
- the current OAuth configurationredirectURL
- the used callback URL. Must be the same from the authentication requestcode
- the code from the authentication server- Returns:
- the POST data
- Since:
- 4.0
-
getDataConnection
default java.net.URLConnection getDataConnection(@Nonnull com.inet.authentication.AuthenticationDescription config, java.lang.String accessToken) throws java.io.IOException
Get the URLConnection for user information. This connection is only if the provider does not support OpenID or for use of access tokens in web API requests.- Parameters:
config
- the current OAuth configurationaccessToken
- the valid accessToken from a previous authentication- Returns:
- The URL to request the data.
- Throws:
java.io.IOException
- if any I/O error occur- Since:
- 20.4
-
getAvatar
@Nullable default java.io.InputStream getAvatar(java.lang.String accessToken)
Alternative method to request the avatar icon. Only called for new users- Parameters:
accessToken
- the valid accessToken from a previous authentication- Returns:
- the stream to an image
- Since:
- 23.10
-
isTrustAllCerificates
default boolean isTrustAllCerificates(@Nonnull com.inet.authentication.AuthenticationDescription config)
Use the authentication server a private certificate and we should trust all certificates. Default is false.- Parameters:
config
- the current OAuth configuration- Returns:
- true for private certificates
- Since:
- 4.0
-
getLoginDisplayName
@Nullable default java.lang.String getLoginDisplayName(@Nullable java.lang.String email, @Nullable java.lang.String givenName, @Nullable java.lang.String familyName, @Nullable java.lang.String alternativeLoginID)
Get the display name of the login in the user manager. If null then the login id will be show.- Parameters:
email
- possible emailgivenName
- possible given namefamilyName
- possible family namealternativeLoginID
- alternative login ID, depends the provider- Returns:
- alternative display name
- Since:
- 23.10
-
getOauthConnectionProvider
@Nullable default java.lang.String getOauthConnectionProvider()
Get the name of the related OauthConnectionProvider from the 'oauth.connection' plugin.- Returns:
- the name or null
- Since:
- 23.10
-
hasOauthConnectionSettings
default boolean hasOauthConnectionSettings()
If this provider has related settings in the 'oauth.connection' plugin.- Returns:
- true, if plugin is available and there are configure settings in the 'oauth.connection' plugin.
- Since:
- 23.10
-
-