Single sign-on (SSO) is an authentication scheme that allows a user to log in with a single username and password to any of several related, yet independent, software systems. DMSContainer provides the SSO Module which is the central authority of a SSO federated services.
Token based authentication (JWT)
Centralize authentication process
Context (application) based authentication
Context and user context data definition
SSO module uses a token to authenticate against a Context (an application or part of it). Using this token the SSO Module knows if user is granted. The token has an expiration time and cannot be tampered as it is signed like a JWT Token.
A Context is a scenario where the user will run into. The context could be an application or a part of it where authentication is required. A context can be provided with some data. This data are available for the logged in user only.
Open Administration Console and select “New Context”. Provide a name and data, as follow:
And click on “Create” button to add the new context.
DMS Administrator can add some data. These data are tied to the context and available for the logged-in user only. It is basically a JSONObject. All users logged in read the same data. Which data Context Data can hold?
DMS Administrator user can add specific configuration per user. Open Administration Console and select Contexts menu to open the contexts list and context’s user list.
To add user context data just click on “Add User To Context” button. DMS Administrator can add 2 kind of extra data to the user-context relation: System Data and User Data.
DMS administrator has the right to write these data only. It holds specific configuration need for that user logged in to a particular context. In the example, user information.
Both user and DMS Administrator can changed these data. Typically this are user specific configuration chosen by the user himself.
To use SSO from your client you need to download a proxy. Open you browser and connect to your DMS server typing this url: https://localhost/info.
Your url may be different, change “localhost” with the right DMS Server location.
DMS provides proxies for different languages. Please download “authrpc” proxy for Delphi language.
This method allows you to get data context: context data, system data and user data.
function IsAuthForContext(const Token: string; SSOContextName: string): TJDOJsonObject;
Let’s discussing its parameters:
This function returns a JSON Object with the context data:
{
"contextname": "",
"username": "",
"contextdata": {
"title": "Application 2"
},
"id": 7,
"iduser": 176,
"idcontext": 4,
"systemdata": {
"first_name": "Peter",
"last_name": "Parker",
"age": 30
},
"userdata": {
"userfolder": "c:\\PeterParker",
"dateformat": "dd/mm/yyyy",
"usenotifications": false,
"knownlanguages": [
"Italian"
]
}
}
As mentioned earlier, userdata, can be modified by the user. UpdateContextUserData allows to update user data:
procedure UpdateContextUserData(const Token: string; const UserContextID: Int64; const UserData: TJsonObject);
Let’s discussing its parameters:
Visibility | Context Data | System Data | User Context Data |
---|---|---|---|
User | Read ** | Read *** | Read/Write *** |
Administrator | Read/Write | Read/Write | Read/Write |
** All users enabled for that Context
*** Only the user where these data are defined
Full example code with all the features explained are available in the official samples provided.