Show / Hide Table of Contents

Class SoCredentialsIdentityResolver

Resolver for credentials representing a NetServer session ticket; success results in an SoCredentialsIdentity being returned. Details are described in the Identity class.

Inheritance
object
AssociateResolver
SoCredentialsIdentityResolver
Implements
ISoIdentityResolver
Inherited Members
AssociateResolver.GetInfoAboutUser()
AssociateResolver.IsPasswordValid(int, string, string)
AssociateResolver.SecretFromPassword(int, string)
AssociateResolver.SecretFromPassword(int, string, string)
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: SuperOffice.Security.Principal
Assembly: SoDataBase.dll
Syntax
[SoIdentityResolver("SoCredentialsIdentityResolver", 1000)]
public sealed class SoCredentialsIdentityResolver : AssociateResolver, ISoIdentityResolver
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

Constructors

SoCredentialsIdentityResolver()

Resolver for credentials representing a NetServer session ticket; success results in an SoCredentialsIdentity being returned. Details are described in the Identity class.

Declaration
public SoCredentialsIdentityResolver()
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

Fields

DbCredentialType

Credential type string in Credentials table

Declaration
public const string DbCredentialType = "Ticket"
Field Value
Type Description
string
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

TicketDuration

Ticket lifetime, with auto-extension whenever it is used

Declaration
public const int TicketDuration = 360
Field Value
Type Description
int
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

TicketSecretPrefix

Resolver for credentials representing a NetServer session ticket; success results in an SoCredentialsIdentity being returned. Details are described in the Identity class.

Declaration
[Obsolete("Use SoCredentialsSecurityToken.TicketSecretPrefix")]
public const string TicketSecretPrefix = "7S:"
Field Value
Type Description
string
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

TicketStringPrefix

Magic string at start of ticket, so we can recognize it

Declaration
[Obsolete("Use SoCredentialsSecurityToken.TicketStringPrefix")]
public const string TicketStringPrefix = "7T:"
Field Value
Type Description
string
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

Methods

CreateSoCredentialsAsync(ProvidedCredential[], int, int, CancellationToken)

Create a session ticket, and its counterpart in the database. Clean out any leftover, invalid tickets at the same time

Declaration
public static Task<SoCredentials> CreateSoCredentialsAsync(ProvidedCredential[] providedCredentials, int associateId, int personId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
ProvidedCredential[] providedCredentials
int associateId
int personId
CancellationToken cancellationToken
Returns
Type Description
Task<SoCredentials>
Remarks

NOTE: To call this method you have to be properly authenticated; it cannot be called during authentication.

RenewSoCredentialsAsync(int, string, DateTime, SoConnection, CancellationToken)

Try to renew credentials; report if the row did not exist

Declaration
public static Task<bool> RenewSoCredentialsAsync(int credentialsRowId, string info, DateTime validTo, SoConnection explicitConnection = null, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int credentialsRowId
string info
DateTime validTo
SoConnection explicitConnection
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

true if the row exists, otherwise false

Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

RenewSoCredentialsAsync(int, string, CancellationToken)

Try to renew credentials; report if the row did not exist

Declaration
public static Task<bool> RenewSoCredentialsAsync(int credentialsRowId, string info, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int credentialsRowId
string info
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

true if the row exists, otherwise false

Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

RenewSoCredentialsAsync(int, CancellationToken)

Try to renew credentials; report if the row did not exist

Declaration
public static Task<bool> RenewSoCredentialsAsync(int credentialsRowId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
int credentialsRowId
CancellationToken cancellationToken
Returns
Type Description
Task<bool>

true if the row exists, otherwise false

Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

ResolveIdentityAsync(IEnumerable<ClaimsIdentity>, SoConnection)

Resolve an identity based on an SoCredentialsSecurityToken, i.e., a NetServer session ticket.

Declaration
public override Task<(ClaimsIdentity claims, string reason)> ResolveIdentityAsync(IEnumerable<ClaimsIdentity> identities, SoConnection dbConnection)
Parameters
Type Name Description
IEnumerable<ClaimsIdentity> identities
SoConnection dbConnection
Returns
Type Description
Task<(ClaimsIdentity claims, string reason)>
Overrides
AssociateResolver.ResolveIdentityAsync(IEnumerable<ClaimsIdentity>, SoConnection)
Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

ResolveTicketDatabaseContextidentifier(string)

Resolve the database contect identifier from a ticket.

Declaration
public static string ResolveTicketDatabaseContextidentifier(string ticket)
Parameters
Type Name Description
string ticket

Ticket to resolve database contect identifier from.

Returns
Type Description
string

Database context identifier.

Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

ResolveTicketToNameAsync(string, CancellationToken)

Resolve a ticket into an associate name, if possible. This method only works if you are in the Authenticated state

Declaration
public static Task<string> ResolveTicketToNameAsync(string ticket, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string ticket

Complete ticket string including 7T: prefix

CancellationToken cancellationToken
Returns
Type Description
Task<string>

Associate name, or blank string

Remarks

Ticket format: GUID-as-string;Random-as-int --> base64. Counterpart in db has searchName == GUID-as-string, while the secret field is a base64-encoded hash of the whole ticket, with arbitrary primarykey = 1234.

Implements

ISoIdentityResolver

Extension Methods

EnumUtil.MapEnums<From, To>(From)
Converters.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top