Class WebOAuthSecurityBindingElementExtension
Reads configuration and initializes the custom binding element that allows to authenticate the service caller with OAuth access token or call an OAuth protected service providing an access token requested from an OAuth authorization server.
Namespace: Nevatech.Vsb.Repository.Security.OAuth
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class WebOAuthSecurityBindingElementExtension : BindingElementExtensionElement
Examples
<webOAuthSecurity metadataEndpoint="https://localhost/auz/oauth/.well-known/openid-configuration" metadataType="OpenIdConnect"> <serviceSettings tokenValidationEndpoint="https://localhost/auz/oauth/connect/accessTokenValidation" tokenType="Reference" tokenParameterName="token" tokenParameterType="FormParameter" tokenFormatString="{0}" tokenParameters="p3=v3&p4=v4" tokenAuthorizationHeader="Basic secret" validationTimeout="00:02:00" cacheLifetime="01:00:00" requireToken="true"> <issuers> <add value="https://localhost/auz/oauth"/> </issuers> <audiences> <add value="https://localhost/service"/> </audiences> <signingCertificateReferences> <add findValue="6b7acc520305bfdb4f7252daeb2177cc091faae1" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint" /> </signingCertificateReferences> <signingCertificates> <add encodedValue="MIIDPjCCAiqgAwIBAgIQsRiM0jheFZhKk4..."/> </signingCertificates> <signingRsaKeys> <add kid="a3rMUgMFv9tPclLa6yF3zAkfquE" exponent="AQAB" modulus="qnTksBdxOiOlsmRNd-mMS2M3o1IDpK4uAr..." /> </signingRsaKeys> <signingSecrets> <add kid="a3rMUgMFv9tPclLa6yF3zAkfquE" secret="qnTksBdxOiOlsmRNd-mMS2M3o1IDpK4uAr..." /> </signingSecrets> </serviceSettings> <clientSettings tokenEndpoint="https://localhost/auz/oauth/connect/token" clientId="client" clientSecret="secret" authenticationType="FormPost" authenticationFlow="ResourceOwner" scopes="openid service" audience="https://localhost/service" parameters="p1=v1&p2=v2" requestTimeout="00:02:00" minimumCacheLifetime="00:00:00" maximumCacheLifetime="01:00:00" clientAssertionLifetime="00:15:00" /> </webOAuthSecurity>
Constructors
WebOAuthSecurityBindingElementExtension()
Declaration
public WebOAuthSecurityBindingElementExtension()
Properties
BindingElementType
Gets the custom binding element object type.
Declaration
public override Type BindingElementType { get; }
Property Value
Type | Description |
---|---|
Type |
Client
Gets element containing information about how client application is calling OAuth/OpendID Connect server in order to retrieve an access token.
Declaration
public WebOAuthSecurityClientElement Client { get; }
Property Value
Type | Description |
---|---|
WebOAuthSecurityClientElement |
MetadataEndpoint
Gets or sets the URI to Open ID Connect or WS-Federation metadata endpoint. This endpoint is used to retrieve the authorization server's signing key, issuer's name, token endpoint, etc.
Declaration
public Uri MetadataEndpoint { get; set; }
Property Value
Type | Description |
---|---|
Uri |
MetadataType
Gets or sets the type of metadata retrieved from MetadataEndpoint. Default is OpenID Connect Discovery document.
Declaration
public OAuthMetadataType MetadataType { get; set; }
Property Value
Type | Description |
---|---|
OAuthMetadataType |
Properties
Gets collection of configuration element properties.
Declaration
protected override ConfigurationPropertyCollection Properties { get; }
Property Value
Type | Description |
---|---|
ConfigurationPropertyCollection |
Service
Gets element containing information about how service validates an access token issued by OAuth/OpenID Connect server and received from a client application.
Declaration
public WebOAuthSecurityServiceElement Service { get; }
Property Value
Type | Description |
---|---|
WebOAuthSecurityServiceElement |
Methods
ApplyConfiguration(BindingElement)
Applies the content of a specified binding element to this binding configuration element.
Declaration
public override void ApplyConfiguration(BindingElement bindingElement)
Parameters
Type | Name | Description |
---|---|---|
BindingElement | bindingElement | A binding element. |
CopyFrom(ServiceModelExtensionElement)
Copies the content of the specified configuration element to this configuration element.
Declaration
public override void CopyFrom(ServiceModelExtensionElement from)
Parameters
Type | Name | Description |
---|---|---|
ServiceModelExtensionElement | from | The configuration element to be copied. |
CreateBindingElement()
Creates and returns a custom binding element object.
Declaration
protected override BindingElement CreateBindingElement()
Returns
Type | Description |
---|---|
BindingElement | A custom binding element object. |
InitializeFrom(BindingElement)
Initializes this binding configuration section with the content of the specified binding element.
Declaration
protected override void InitializeFrom(BindingElement bindingElement)
Parameters
Type | Name | Description |
---|---|---|
BindingElement | bindingElement | A binding element. |