Class IdentityProvider
- Namespace
- Fdyay.IdentityServer.Models
- Assembly
- Fdyay.IdentityServer.Core.dll
An external identity provider a host can add, change or remove without a restart.
public class IdentityProvider
- Inheritance
-
IdentityProvider
- Derived
- Inherited Members
Remarks
The statically registered providers — AddExternalOpenIdConnect and its siblings — are fixed at
startup, which is right for a deployment whose partners are known when it is built and wrong for one where
a tenant brings its own. This is the other shape: a row a host stores, and a scheme that appears
everywhere a registered one does.
Properties is the storage format and the typed members on a subclass are the reading of it. A provider is one row whatever protocol it speaks, so a host can store it in one table and this server can hand it to a handler that knows nothing about identity providers.
Constructors
IdentityProvider()
An empty provider, for an initializer to fill; Scheme must be set.
public IdentityProvider()
IdentityProvider(string, IdentityProvider)
A copy of other, which must be of the kind named — what a subclass's copy constructor calls.
[SetsRequiredMembers]
public IdentityProvider(string type, IdentityProvider other)
Parameters
typestringotherIdentityProvider
Remarks
Duende 8.0.1's, measured: the scheme, display name, enabled flag and kind, and a Properties of the copy's own, so editing one does not edit the other. A row of another kind is refused, because reading it through this kind's typed members would read the wrong settings. Through IIdentityProviderFactory it is how a row a store holds as this base type becomes the subclass its kind registers.
Properties
DisplayName
What the sign-in page calls it. A provider with none is not offered as a button.
public string? DisplayName { get; set; }
Property Value
Remarks
The same rule the static providers already follow: the chooser lists schemes that have a display name, because a scheme without one is infrastructure rather than a way in.
Enabled
Whether this provider may be used at all. Defaults to true.
public bool Enabled { get; set; }
Property Value
Properties
The provider's settings, as the flat pairs a store keeps.
public IDictionary<string, string?> Properties { get; }
Property Value
Scheme
The authentication scheme name, unique across static and dynamic providers alike.
public required string Scheme { get; set; }
Property Value
Type
Which registered provider type reads Properties — oidc, say.
public string Type { get; set; }
Property Value
Remarks
Names an entry in DynamicProviderOptions rather than a .NET type, because this value is stored
and a type name in a database is a rename away from orphaning every row that holds it.
Not required, unlike Scheme, because a subclass sets it in its own constructor and
a required member has to be assigned by the caller even when a constructor already has. Empty names no
registered kind, which resolves to no scheme — the same answer a row for an unregistered kind gets.
Methods
GetFlag(string)
The flag stored under name, read as a bool.
protected bool GetFlag(string name)
Parameters
namestringThe setting's key.
Returns
- bool
True when the stored value parses as true (ignoring case); false when it is absent or anything else.
GetProperty(string)
The setting stored under name in Properties.
protected string? GetProperty(string name)
Parameters
namestringThe setting's key.
Returns
- string
Its value, or null when it is not stored.
SetFlag(string, bool)
Stores a flag under name as True or False.
protected void SetFlag(string name, bool value)
Parameters
SetProperty(string, string?)
Stores value under name in Properties, replacing any value there.
protected void SetProperty(string name, string? value)