ClaimsAuth Class
Properties Methods Events Configuration Settings Errors
The ClaimsAuth component is used to obtain security tokens and assertions.
Syntax
ClaimsAuth
Remarks
The ClaimsAuth class provides an easy-to-use interface to obtain security tokens and assertions. The class can also be used to simple parse assertions and inspect the claims within.
The component has built in support for working with Microsoft SharePoint Online and Microsoft Dynamics CRM Online. This support means only a minimum of information needs to be supplied to the component.
Microsoft SharePoint Online and Dynamics CRM Online
To begin working with SharePoint Online or Dynamics CRM Online first set the AuthMode to the appropriate value. The class will automatically populate several properties to known values. Set the User, Password, ApplicationURN properties and call GetSecurityToken. For instance:
component.AuthMode = ClaimsauthAuthModes.amDynamicsCRM; //dynamic crm component.User = "user@mycrm.onmicrosoft.com"; component.Password = "password"; component.ApplicationURN = "urn:crmapac:dynamics.com"; component.GetSecurityToken();After calling GetSecurityToken the SecurityTokenXML property will be populated.
ADFS and Others
When working with ADFS or another Security Token Service (STS) the GetAssertion method may be used to obtain an assertion. To begin set AuthMode to either amADFS or amCustom. Then set LocalSTS, User, Password, and ApplicationURN. For instance:
component.AuthMode = ClaimsauthAuthModes.amADFS; component.User = "administrator"; component.Password = "admin"; component.LocalSTS = "https://adfs.contoso.com"; component.ApplicationURN = "https://fsweb.contoso.com/ClaimsAwareWebAppWithManagedSTS/"; component.GetAssertion();If the assertion is signed the class will use the certificate specified in SignerCert to verify the signature. If SignerCert is not set the class will attempt to parse the certificate present in the assertion to perform verification.
After the assertion is parsed and the signature is verified (if present) the following properties will be populated:
- AssertionId
- AssertionIssueInstant
- AssertionIssuer
- AssertionNotBefore
- AssertionNotOnOrAfter
- AssertionSubject
- AssertionVersion
- AssertionXML
- Claim* properties
Parsing an Assertion
The class may also be used to parse an existing assertion without contacting a STS. To parse an existing assertion call ParseAssertion with the assertion XML. If the assertion is signed the class will use the certificate specified in SignerCert to verify the signature. If SignerCert is not set the class will attempt to parse the certificate present in the assertion to perform verification.
After the assertion is parsed and the signature is verified (if present) the following properties will be populated:
- AssertionId
- AssertionIssueInstant
- AssertionIssuer
- AssertionNotBefore
- AssertionNotOnOrAfter
- AssertionSubject
- AssertionVersion
- AssertionXML
- Claim* properties
Property List
The following is the full list of the properties of the class with short descriptions. Click on the links for further details.
ApplicationURN | The application's Uniform Resource Name (URN). |
AssertionId | The assertion id. |
AssertionIssueInstant | The time in UTC that the assertion was issued. |
AssertionIssuer | The assertion issuer. |
AssertionNotBefore | The date on which the assertion becomes valid. |
AssertionNotOnOrAfter | The time at which the assertion expires. |
AssertionSubject | The subject of the assertion. |
AssertionVersion | The version of the assertion. |
AssertionXML | The assertion XML. |
AuthMode | The authentication mode. |
CertEncoded | The certificate (PEM/base64 encoded). |
CertStore | The name of the certificate store for the client certificate. |
CertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
CertStoreType | The type of certificate store for this certificate. |
CertSubject | The subject of the certificate used for client authentication. |
ClaimCount | The number of records in the Claim arrays. |
ClaimIssuerName | The name of the issuer. |
ClaimOriginalIssuer | The name of the original issuer. |
ClaimPropertyCount | The number of properties in the claim. |
ClaimPropertyIndex | Selects a property. |
ClaimPropertyName | The name of the property. |
ClaimPropertyValue | The value of the property. |
ClaimTypeName | The type name of the claim. |
ClaimValue | The value of the claim. |
ClaimValueType | The type of value. |
FederationSTS | The URL of the federation Security Token Service (STS). |
FederationURN | The federation Uniform Resource Name (URN). |
LocalSTS | The local Security Token Service (STS). |
Password | The user's password. |
ProxyAuthScheme | This property is used to tell the component which type of authorization to perform when connecting to the proxy. |
ProxyAutoDetect | This property tells the component whether or not to automatically detect and use proxy system settings, if available. |
ProxyPassword | This property contains a password if authentication is to be used for the proxy. |
ProxyPort | This property contains the TCP port for the proxy Server (default 80). |
ProxyServer | If a proxy Server is given, then the HTTP request is sent to the proxy instead of the server otherwise specified. |
ProxySSL | This property determines when to use SSL for the connection to the proxy. |
ProxyUser | This property contains a user name, if authentication is to be used for the proxy. |
SecurityTokenXML | The security token XML. |
SignerCertEncoded | The certificate (PEM/base64 encoded). |
SignerCertStore | The name of the certificate store for the client certificate. |
SignerCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
SignerCertStoreType | The type of certificate store for this certificate. |
SignerCertSubject | The subject of the certificate used for client authentication. |
SSLAcceptServerCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertStore | The name of the certificate store for the client certificate. |
SSLCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
SSLCertStoreType | The type of certificate store for this certificate. |
SSLCertSubject | The subject of the certificate used for client authentication. |
SSLServerCertEncoded | The certificate (PEM/base64 encoded). |
User | The username. |
AttrCount | The number of records in the Attr arrays. |
AttrName | The Name provides the local name (without prefix) of the attribute. |
AttrNamespace | Attribute namespace. |
AttrPrefix | Attribute prefix (if any). |
AttrValue | Attribute value. |
XChildrenCount | The number of records in the XChild arrays. |
XChildName | The Name property provides the local name (without prefix) of the element. |
XChildNamespace | Namespace of the element. |
XChildPrefix | Prefix of the element (if any). |
XChildXText | The inner text of the element. |
XElement | The name of the current element. |
XNamespace | The namespace of the current element. |
XParent | The parent of the current element. |
XPath | Provides a way to point to a specific element in the document. |
XPrefix | The prefix of the current element. |
XSubTree | A snapshot of the current element in the document. |
XText | The text of the current element. |
Method List
The following is the full list of the methods of the class with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting . |
GetAssertion | Gets the assertion. |
GetSecurityToken | Gets the security token. |
ParseAssertion | Parses the specified assertion. |
Event List
The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.
Characters | Fired for plain text segments of the input stream. |
Comment | Fired when a comment section is encountered. |
EndElement | Fired when an end-element tag is encountered. |
Error | Information about errors during data delivery. |
PI | Fired when a processing instruction section is encountered. |
SSLServerAuthentication | Fired after the server presents its certificate to the client. |
SSLStatus | Shows the progress of the secure connection. |
StartElement | Fired when a begin-element tag is encountered in the document. |
Configuration Settings
The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.
DecryptAssertion | Whether to decrypt the assertion. |
RawRequest | Returns the raw HTTP request. |
RawResponse | Returns the raw HTTP response. |
SSODomain | Specifies the federation domain configured in Office 365. |
UserRealm | The URL of a web service to determine the LocalSTS (if any). |
CodePage | The system code page used for Unicode to Multibyte translations. |