Concept
OpenID Connect is a protocol for delegating the authentication of an application to a third-party application called an Identity Provider (IDP). Based on the OAuth 2 protocol and its authorisation code, OpenId Connect is used by FlowerDocs GUI to provide its users with a Single Sign On.
From the authentication page, users authenticate by selecting one of the Identity Providers displayed.
Once authenticated at the Identity Provider, the user is redirected to a redirect URL redirect_uri
from FlowerDocs GUI with an authorization code generated by the Identity Provider.
Based on this authorization code, FlowerDocs GUI initializes the user’s HTTP session after retrieving the id_token
and access_token
from the Identity Provider. A user token specific to FlowerDocs is then generated.
Prerequisites
1. FlowerDocs Core ’s secret key must be shared with FlowerDocs GUI in order to use this mechanism.
Sharing the secret key is necessary so that FlowerDocs GUI can initialize the user session by generating a valid user token ( token.key
property in the gui.properties file).
2. Authorization of the removal URL in the Identity Provider
Configuration
An Identity Provider OpenId Connect can be configured via the FlowerDocs administration console.
This configuration is stored inthe OAuthClientConfiguration
class technical documents. The various parameters to be entered are stored in tags.
Access account
Most Identity Providers require authentication to start the authentication process. To configure the account used by FlowerDocs to contact the Identity Provider, it is necessary to value the tags:
ClientId
: the identifier representing the client application (or Relying party): FlowerDocs GUIClientSecret
: the password associated with the identifier
Link to FlowerDocs
RedirectUriTemplate
: template used to generate the parameterredirect_uri
(value must be set to {baseUrl}/login/oauth2/code/{registrationId})Scope
: OAuth 2.0 scopes (at least openid and email)UserNameAttributeName
: Name of attribute to be used as user identifierRegistrationId
: Unique identifier for authorization serverClientName
: Customer nameIcon
: Font Awesome icon to display on login pageMemberOfAttribute
: Attribute name for providing groups
Endpoints
The various endpoints required by the OpenId Connect protocol must be configured using the following tags:
AuthorizationUri
: User authorization endpointTokenUri
: Endpoint for token recoveryJwkSetUri
: Endpoint used to access the authorization server’s public key (JWK) used to validate information receivedUserInfoUri
: Endpoint displaying user attributes (or claims)
For more details, see specifications OpenId Connect
Examples
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:Document category="DOCUMENT" name="Google" xmlns="http://flower.com/docs/domain/common"
xmlns:ns2="http://flower.com/docs/domain/component" xmlns:ns3="http://flower.com/docs/domain/document">
<id>Google</id>
<ns2:data>
<ns2:classId>OAuthClientConfiguration</ns2:classId>
</ns2:data>
<ns2:Tags>
<ns2:tags name="ClientId" readOnly="false">
<ns2:value>***</ns2:value>
</ns2:tags>
<ns2:tags name="ClientSecret" readOnly="false">
<ns2:value>***</ns2:value>
</ns2:tags>
<ns2:tags name="RedirectUriTemplate" readOnly="false">
<ns2:value>{baseUrl}/login/oauth2/code/{registrationId}</ns2:value>
</ns2:tags>
<ns2:tags name="Scope" readOnly="false">
<ns2:value>openid</ns2:value>
<ns2:value>profile</ns2:value>
<ns2:value>email</ns2:value>
<ns2:value>address</ns2:value>
<ns2:value>phone</ns2:value>
</ns2:tags>
<ns2:tags name="AuthorizationUri" readOnly="false">
<ns2:value>https://accounts.google.com/o/oauth2/v2/auth</ns2:value>
</ns2:tags>
<ns2:tags name="TokenUri" readOnly="false">
<ns2:value>https://www.googleapis.com/oauth2/v4/token</ns2:value>
</ns2:tags>
<ns2:tags name="JwkSetUri" readOnly="false">
<ns2:value>https://www.googleapis.com/oauth2/v3/certs</ns2:value>
</ns2:tags>
<ns2:tags name="UserInfoUri" readOnly="false">
<ns2:value>https://www.googleapis.com/oauth2/v3/userinfo</ns2:value>
</ns2:tags>
<ns2:tags name="UserNameAttributeName" readOnly="false">
<ns2:value>sub</ns2:value>
</ns2:tags>
<ns2:tags name="RegistrationId" readOnly="false">
<ns2:value>google</ns2:value>
</ns2:tags>
<ns2:tags name="ClientName" readOnly="false">
<ns2:value>Google</ns2:value>
</ns2:tags>
<ns2:tags name="Icon" readOnly="false">
<ns2:value>border-danger text-danger mdi mdi-google</ns2:value>
</ns2:tags>
</ns2:Tags>
</ns3:Document>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns3:Document category="DOCUMENT" name="Microsoft" xmlns="http://flower.com/docs/domain/common"
xmlns:ns2="http://flower.com/docs/domain/component" xmlns:ns3="http://flower.com/docs/domain/document">
<id>Microsoft</id>
<ns2:data>
<ns2:classId>OAuthClientConfiguration</ns2:classId>
</ns2:data>
<ns2:Tags>
<ns2:tags name="ClientId" readOnly="false">
<ns2:value>***</ns2:value>
</ns2:tags>
<ns2:tags name="ClientSecret" readOnly="false">
<ns2:value>***</ns2:value>
</ns2:tags>
<ns2:tags name="AuthorizationGrantType" readOnly="false">
<ns2:value>{baseUrl}/login/oauth2/code/{registrationId}</ns2:value>
</ns2:tags>
<ns2:tags name="RedirectUriTemplate" readOnly="false">
<ns2:value>{baseUrl}/login/oauth2/code/{registrationId}</ns2:value>
</ns2:tags>
<ns2:tags name="Scope" readOnly="false">
<ns2:value>openid</ns2:value>
<ns2:value>profile</ns2:value>
<ns2:value>email</ns2:value>
</ns2:tags>
<ns2:tags name="AuthorizationUri" readOnly="false">
<ns2:value>https://login.microsoftonline.com/common/oauth2/v2.0/authorize</ns2:value>
</ns2:tags>
<ns2:tags name="TokenUri" readOnly="false">
<ns2:value>https://login.microsoftonline.com/common/oauth2/v2.0/token</ns2:value>
</ns2:tags>
<ns2:tags name="JwkSetUri" readOnly="false">
<ns2:value>https://login.microsoftonline.com/common/discovery/v2.0/keys</ns2:value>
</ns2:tags>
<ns2:tags name="UserInfoUri" readOnly="false">
<ns2:value>https://graph.microsoft.com/oidc/userinfo</ns2:value>
</ns2:tags>
<ns2:tags name="UserNameAttributeName" readOnly="false">
<ns2:value>sub</ns2:value>
</ns2:tags>
<ns2:tags name="RegistrationId" readOnly="false">
<ns2:value>microsoft</ns2:value>
</ns2:tags>
<ns2:tags name="ClientName" readOnly="false">
<ns2:value>Microsoft</ns2:value>
</ns2:tags>
<ns2:tags name="Icon" readOnly="false">
<ns2:value>border-info text-info mdi mdi-microsoft</ns2:value>
</ns2:tags>
</ns2:Tags>
</ns3:Document>
Automatic connection
To authenticate a user automatically using this authentication mechanism, you can add the parameter sso=auto
to the URL.
With this parameter, the user is automatically authenticated using OpenId Connect when accessing the login page.