-
Notifications
You must be signed in to change notification settings - Fork 0
AC Session
Session
is one of the most important entities of the Authority Controller addon. An instance of that class impersonates a current authority session and manages all generated tokens and its rights.
- The class located at the
AuthorityController
namespace. - Implements Singleton pattern. A current instance available via the
AuthorityController.Session.Current
property. - Allows a multi-layer network architecture where existed following servers that must be informed about allocated tokens and provided rights.
The following example demonstrates the way to assign a token to some User
.
// Generate new token.
string sessionToken = UniformQueries.Tokens.UnusedToken;
// Registrate token for user.
Session.Current.AssignTokenToUser(
USER_PROFILE,
sessionToken);
// Set rights.
Session.Current.SetTokenRights(sessionToken, user.rights);
- Where
USER_PROFILE
is an isntance of theAuthorityController.Data.Personal.User
class or a derived one that contains a data relative to certain user.
Look at the USER LOGON query's source for full example.
The follwong example shows how to get an information about a token.
AuthorityController.Session.Current.TryGetTokenInfo(
USER_TOKEN,
out TokenInfo info);
- Where the
USER_TOKEN
is an unique token allocated for certain user.
You can get only the rights assigned to the token by using the
TryGetTokenRights
method.
In that example we will finalize the token rights and close it's session.
AuthorityController.Session.Current.SetExpired(
USER_TOKEN);
- Where the
USER_TOKEN
is an unique token allocated for certain user.
After that operation token will removed from the session and lose all rights.
In case if some of your servers must know tokens information managed by an authority server then you should describe routs to that servers into a RoutingTable
and set the table to the AuthorityController.Session.Current.AuthorityFollowers
property. After that any authority action procced by the authority server will be shared to the follwing servers via the SET TOKEN RIGHTS query.
Note that the shared data will be partially erased to prevent sharing some personal secure data. Following server will know only tokens and bonded rights but haven't know information about target users.
- Donate: Why support the initiative? | Patreon
- Contacts: LinkedIn
- See also: WPF Handler | Uniform Data Operator | Datum Point