Interface OAuthServerDescription
public interface OAuthServerDescription
The description of an OAuth authentication server
- Since:
- 4.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
cache for registered instances -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionapplySettings
(String loginType, Map<String, String> clientProperties) Convert the properties from the GUI to the properties that should be saved.applySettings
(Map<String, String> clientProperties, com.inet.config.Configuration config, List<Map<String, String>> originalInConfig) Convert the properties from the GUI to the properties that should be saved.static OAuthServerDescription
FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cachegetAuthenticationURL
(com.inet.authentication.AuthenticationDescription config) The URL of the authentication redirect without parameters.default String
getAuthenticationURL
(com.inet.authentication.AuthenticationDescription config, String redirectURL, String state) Add the needed parameters to the authentication redirect URL.default InputStream
Alternative method to request the avatar icon.default String
Get the color as hex value, e.g.default URLConnection
getDataConnection
(com.inet.authentication.AuthenticationDescription config, String accessToken) Get the URLConnection for user information.default String
getIconURL
(Map<String, String> settings) Get the Icon resource URL.default String
getLoginDisplayName
(String email, String givenName, String familyName, String alternativeLoginID) Get the display name of the login in the user manager.default String
Get the name of the related OauthConnectionProvider from the 'oauth.connection' plugin.default String
getScope
(com.inet.authentication.AuthenticationDescription config) Get the scope value.default String
getTokenData
(com.inet.authentication.AuthenticationDescription config, String redirectURL, String code) The POST data to verify the login from the servergetTokenURL
(com.inet.authentication.AuthenticationDescription config) The POST URL to verify the login from the server.default boolean
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.name()
Get the loginSource/name for this server.default void
transformGuiProperties
(Map<String, Object> properties) Transform the loaded values to the format required for the configuration GUI
-
Field Details
-
CLIENT_ID
Key of the client-id property- See Also:
-
CLIENT_SECRET
Key of the client-secret property- See Also:
-
USE_OAUTH_CONNECTION
Key if the setting from 'oauth.connection' plugin is used- See Also:
-
OAUTH_CONNECTION
static final boolean OAUTH_CONNECTIONif oauth.connection plugin is loaded
-
-
Method Details
-
get
FOR INTERNAL USE ONLY Get OAuthServerDescription with the given name from cache- Parameters:
name
- the name- Returns:
- OAuthServerDescription or null
- Since:
- 23.10
-
name
Get the loginSource/name for this server.- Returns:
- the login source
- Since:
- 4.0
-
getColor
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
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
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 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 String getAuthenticationURL(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, 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
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 String getTokenData(@Nonnull com.inet.authentication.AuthenticationDescription config, String redirectURL, 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 URLConnection getDataConnection(@Nonnull com.inet.authentication.AuthenticationDescription config, String accessToken) throws 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:
IOException
- if any I/O error occur- Since:
- 20.4
-
getAvatar
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 String getLoginDisplayName(@Nullable String email, @Nullable String givenName, @Nullable String familyName, @Nullable String alternativeLoginID) Get the display name of the login in the user manager. If null then the login id will be show. The default implementation will try to create a display name in the form:FirstName LastName <Email>
- If only First or Last name are given, they will prefix the email (if given)
- If only the email is given, then only the email will be returned.
- If none of those are given, null is returned and results in the original login id
- Parameters:
email
- possible emailgivenName
- possible given namefamilyName
- possible family namealternativeLoginID
- alternative login ID, depends the provider- Returns:
- alternative display name
- Since:
- 23.10
-
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
-
transformGuiProperties
Transform the loaded values to the format required for the configuration GUI- Parameters:
properties
- the loaded properties- Since:
- 24.4
-
applySettings
@Nonnull default Map<String,String> applySettings(@Nonnull Map<String, String> clientProperties, @Nonnull com.inet.config.Configuration config, @Nonnull List<Map<String, String>> originalInConfig) Convert the properties from the GUI to the properties that should be saved. Typical this is a filter only.- Parameters:
clientProperties
- properties from the GUIconfig
- the Configuration that will edit in the configuration manager GUIoriginalInConfig
- the parsed, read only login settings in configuration- Returns:
- the values to be saved
- Since:
- 24.4
-
applySettings
static Map<String,String> applySettings(@Nonnull String loginType, @Nonnull Map<String, String> clientProperties) Convert the properties from the GUI to the properties that should be saved. Typical this is a filter only.- Parameters:
loginType
- the login type prefix name to check for additional settingsclientProperties
- properties from the GUI- Returns:
- the values to be saved
- Since:
- 24.4
-