Class UserAuthorizationCache
Represents in-memory cache of the user's authorization/authentication records. Allows to find a user by one of his identities.
Inheritance
Implements
Inherited Members
Namespace: Nevatech.Vsb.Repository.Security
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class UserAuthorizationCache : IDisposable
Constructors
UserAuthorizationCache()
Initializes an empty instance.
Declaration
public UserAuthorizationCache()
Properties
Current
Gets singleton instance of the cache.
Declaration
public static UserAuthorizationCache Current { get; }
Property Value
Type | Description |
---|---|
UserAuthorizationCache |
ExpirationInterval
Gets or sets the time period indicating how long user's authorization info will be stored in the cache. Default is 20 minutes.
Declaration
public TimeSpan ExpirationInterval { get; set; }
Property Value
Type | Description |
---|---|
System.TimeSpan |
FederationClaimIssuer
Gets or sets the optional issuer of the claim used to authenticate user in Federation scenario. If it is set then claim's issuer is validated and identity match is performed by the claim value only. If it is not set then identity match is performed by the claim value and issuer.
Declaration
public string FederationClaimIssuer { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FederationClaimType
Gets or sets the claim type of the claim used to authenticate user in Federation scenario.
Declaration
public string FederationClaimType { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IgnoredGroups
Gets collection of Windows groups SIDs that are not accepted for Windows group user authentication and should not be matched.
Declaration
public HashSet<string> IgnoredGroups { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.HashSet<System.String> |
MinimumItemsToPurge
Gets or sets the minimum number of items stored in the cache that triggers cache clean up that removes expired items. Default is 100 items.
Declaration
public int MinimumItemsToPurge { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
Authenticate(String, String, Boolean)
Validates provided user name and password and returns flag indicating that they belong to an active (not disabled) user.
Declaration
public bool Authenticate(string userName, string password, bool portalUser)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | User name that needs to be validated. |
System.String | password | Password that needs to be validated. |
System.Boolean | portalUser | True if the user being authenticated is Sentinet Developer Portal user, false otherwise. |
Returns
Type | Description |
---|---|
System.Boolean | True, if credentials belong to an active (not disabled) user. False, otherwise. |
Authorize(ClaimsPrincipal, String, Boolean)
Validates that user is authorized to access Repository Service and adds claims to his identity indicating his access level.
Declaration
public bool Authorize(ClaimsPrincipal principal, string clientAddress, bool portalUser)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Claims.ClaimsPrincipal | principal | User's principal that needs to be authorized. |
System.String | clientAddress | IP address of the caller. |
System.Boolean | portalUser | True if the user being authenticated is Sentinet Developer Portal user, false otherwise. |
Returns
Type | Description |
---|---|
System.Boolean | True, if user is authorized to access Repository Service. False, otherwise. |
Dispose()
Releases internal resources.
Declaration
public void Dispose()
FindByFederatedClaim(ClaimsIdentity)
Finds user authorization information by a claim issued by a federated identity provider.
Declaration
public UserAuthorizationInfo FindByFederatedClaim(ClaimsIdentity claimsIdentity)
Parameters
Type | Name | Description |
---|---|---|
System.Security.Claims.ClaimsIdentity | claimsIdentity | The claims identity for which to find the authorization info. |
Returns
Type | Description |
---|---|
UserAuthorizationInfo | The Nevatech.Vsb.Repository.Security.UserAuthorizationCache.AuthorizationInfo instance if found or null. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified |
FindByUserName(String)
Finds user authorization information by name.
Declaration
public UserAuthorizationInfo FindByUserName(string userName)
Parameters
Type | Name | Description |
---|---|---|
System.String | userName | The name of the user for which to find the authorization info. |
Returns
Type | Description |
---|---|
UserAuthorizationInfo | The Nevatech.Vsb.Repository.Security.UserAuthorizationCache.AuthorizationInfo instance if found or null. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Thrown if the specified |