Class SemanticAuthentication
Wraps another authenticator, attaching semantic meaning to the username. Semantic alternates are stored in ASP.NET Identity-compatible claims.
public sealed class SemanticAuthentication : IAuthentication
- Inheritance
-
SemanticAuthentication
- Implements
- Inherited Members
Remarks
Requires DB access before remote authentication, so it's not suitable for client-server apps. As such the implementation of sign/encrypt is a bit futile, although it would work if that was overcome (perhaps by replacing the lookup with an RPC).
Constructors
SemanticAuthentication(IAuthentication, Semantics)
Wraps another authenticator, attaching semantic meaning to the username. Semantic alternates are stored in ASP.NET Identity-compatible claims.
public SemanticAuthentication(IAuthentication inner, Semantics semantics = Semantics.Any)
Parameters
innerIAuthenticationsemanticsSemantics
Remarks
Requires DB access before remote authentication, so it's not suitable for client-server apps. As such the implementation of sign/encrypt is a bit futile, although it would work if that was overcome (perhaps by replacing the lookup with an RPC).
Fields
EmailAddressClaim
public const string EmailAddressClaim = "identity.email.address"
Field Value
EmailConfirmedClaim
public const string EmailConfirmedClaim = "identity.email.confirmed"
Field Value
PhoneConfirmedClaim
public const string PhoneConfirmedClaim = "identity.phone.confirmed"
Field Value
PhoneNumberClaim
public const string PhoneNumberClaim = "identity.phone.number"
Field Value
Properties
CanEncrypt
true if the authenticator supports secured key exchange
public bool CanEncrypt { get; }
Property Value
Remarks
this is used to establish shared secrets. implementations could be based on public key cryptography, diffie-helmann, or out of band methods
CanLookup
true if the authenticator supports looking up an IUserAccount for an authenticator-specific username
public bool CanLookup { get; }
Property Value
CanSign
true if the authenticator supports digital signatures (not necessarily cryptographic)
public bool CanSign { get; }
Property Value
Remarks
signature doesn't have to be based on the operation; it can use some other capability like ambient windows logon
IsAuthoritative
If true, the returned identity should be accepted without server verification
public bool IsAuthoritative { get; }
Property Value
Remarks
May depend on ambient state - don't cache the result. As well as enabling automatic login, this is used by SecurityService to decide whether it's ok to perform purely-local authentication without calling IEntityStore.Connect.
Realm
Describes identities within the purview of this authenticator
public string Realm { get; }
Property Value
RequiresCredentials
Expects non-empty Credentials in order to perform client-side identity operations
public bool RequiresCredentials { get; }
Property Value
Methods
FindAccountAsync(IEntityContext, Credentials)
Look up a user account based on the identity components of the supplied credentials.
public Task<IUserAccount?> FindAccountAsync(IEntityContext context, Credentials credentials)
Parameters
contextIEntityContextcredentialsCredentials
Returns
Remarks
Does not validate or normalise credentials.
SetEmailAddressAsync(IUserAccount, string)
public static Task SetEmailAddressAsync(IUserAccount account, string emailAddress)
Parameters
accountIUserAccountemailAddressstring
Returns
SetPhoneNumberAsync(IUserAccount, string)
public static Task SetPhoneNumberAsync(IUserAccount account, string phoneNumber)
Parameters
accountIUserAccountphoneNumberstring