Class SoCredentialsIdentityResolver
Resolver for credentials representing a NetServer session ticket; success results in an SoCredentialsIdentity being returned. Details are described in the Identity class.
Implements
Inherited Members
Namespace: SuperOffice.Security.Principal
Assembly: SoDataBase.dll
Syntax
[SoIdentityResolver("SoCredentialsIdentityResolver", 1000)]
public sealed class SoCredentialsIdentityResolver : AssociateResolver, ISoIdentityResolver, IPlugin
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 |
---|---|
Int32 |
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
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
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
CreateSoCredentials(ProvidedCredential[], Int32, Int32, ref Int32)
Create a session ticket, and its counterpart in the database. Clean out any leftover, invalid tickets at the same time
Declaration
public static SoCredentials CreateSoCredentials(ProvidedCredential[] providedCredentials, int associateId, int personId, ref int credentialsRowId)
Parameters
Type | Name | Description |
---|---|---|
ProvidedCredential[] | providedCredentials | |
Int32 | associateId | |
Int32 | personId | |
Int32 | credentialsRowId |
Returns
Type | Description |
---|---|
SoCredentials |
Remarks
NOTE: To call this method you have to be properly authenticated; it cannot be called during authentication.
RenewSoCredentials(Int32)
Try to renew credentials; report if the row did not exist
Declaration
public static bool RenewSoCredentials(int credentialsRowId)
Parameters
Type | Name | Description |
---|---|---|
Int32 | credentialsRowId |
Returns
Type | Description |
---|---|
Boolean | 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.
RenewSoCredentials(Int32, String)
Try to renew credentials; report if the row did not exist
Declaration
public static bool RenewSoCredentials(int credentialsRowId, string info)
Parameters
Type | Name | Description |
---|---|---|
Int32 | credentialsRowId | |
String | info |
Returns
Type | Description |
---|---|
Boolean | 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.
RenewSoCredentials(Int32, String, DateTime)
Try to renew credentials; report if the row did not exist
Declaration
public static bool RenewSoCredentials(int credentialsRowId, string info, DateTime validTo)
Parameters
Type | Name | Description |
---|---|---|
Int32 | credentialsRowId | |
String | info | |
DateTime | validTo |
Returns
Type | Description |
---|---|
Boolean | 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.
ResolveIdentity(IEnumerable<ClaimsIdentity>, SoConnection, out String)
Resolve an identity based on an SoCredentialsSecurityToken, i.e., a NetServer session ticket.
Declaration
public override ISoIdentity ResolveIdentity(IEnumerable<ClaimsIdentity> identities, SoConnection dbConnection, out string reason)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ClaimsIdentity> | identities | |
SoConnection | dbConnection | |
String | reason |
Returns
Type | Description |
---|---|
ISoIdentity |
Overrides
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.
ResolveTicketToName(String)
Resolve a ticket into an associate name, if possible. This method only works if you are in the Authenticated state
Declaration
public static string ResolveTicketToName(string ticket)
Parameters
Type | Name | Description |
---|---|---|
String | ticket | Complete ticket string including 7T: prefix |
Returns
Type | Description |
---|---|
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.