CredentialsContainer Class
The credentials API of a window (https://w3c.github.io/webappsec-credential-management/#credentialscontainer): navigator.credentials. The library implements the password and federated credentials (PasswordCredential, FederatedCredential), whose credential store and chooser are the ones of BrowsingContextOptions.UserAgentUI, and the Web Authentication credentials (PublicKeyCredential), whose authenticators are given by BrowsingContextOptions.WebAuthentication.
public sealed class CredentialsContainerMethods
| Name | Description |
|---|---|
| Create(CredentialCreationOptions?) | Creates a credential (https://w3c.github.io/webappsec-credential-management/#algorithm-create): a PasswordCredential or a FederatedCredential from their data (they are not stored), or a Web Authentication registration when CredentialCreationOptions.PublicKey is set. The task fails with an InvalidStateError DomException when the document is not fully active, a NotSupportedError when the options request no type of credential or several types, a TypeErrorException when the data is not valid, a NotAllowedError when the document is not allowed to use the publickey-credentials-create feature (nor the payment feature) or a request is already pending, and the errors of the ceremony. |
| Get(CredentialRequestOptions?) | Requests a credential (https://w3c.github.io/webappsec-credential-management/#algorithm-request): the stored password or federated credentials chosen by the user (UserAgentUIBackend.ChooseCredentialAsync) when CredentialRequestOptions.Password or CredentialRequestOptions.Federated is set, or a Web Authentication assertion when CredentialRequestOptions.PublicKey is set. The task fails with an InvalidStateError DomException when the document is not fully active, a NotSupportedError when the options request no supported type of credential or a combination of types that cannot be requested together, a NotAllowedError when the document is not allowed to use the feature of the type, a request is already pending or the document is in a frame that is not same origin with its ancestors (password and federated credentials), and the errors of the ceremony. |
| PreventSilentAccess() | Prevents the silent access to the credentials of the origin of the document (https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-preventsilentaccess): the origin requires user mediation (CredentialChooserPrompt.RequiresUserMediation) until the user chooses a credential. The task fails with an InvalidStateError DomException when the document is not fully active. |
| Store(Credential) | Stores a credential (https://w3c.github.io/webappsec-credential-management/#algorithm-store): the user is asked whether to save a password or federated credential (UserAgentUIBackend.StoreCredentialAsync), and the task completes whatever the answer. The task fails with a NotAllowedError DomException when the document is in a frame that is not same origin with its ancestors, a SecurityError when the origin of the credential is not the origin of the document, and a NotSupportedError for the other types of credentials (the public key credentials cannot be stored). |
Create(CredentialCreationOptions?)
CredentialsContainer.csCreates a credential (https://w3c.github.io/webappsec-credential-management/#algorithm-create): a PasswordCredential or a FederatedCredential from their data (they are not stored), or a Web Authentication registration when CredentialCreationOptions.PublicKey is set. The task fails with an InvalidStateError DomException when the document is not fully active, a NotSupportedError when the options request no type of credential or several types, a TypeErrorException when the data is not valid, a NotAllowedError when the document is not allowed to use the publickey-credentials-create feature (nor the payment feature) or a request is already pending, and the errors of the ceremony.
public Task<Credential?> Create(CredentialCreationOptions? options = null)Get(CredentialRequestOptions?)
CredentialsContainer.csRequests a credential (https://w3c.github.io/webappsec-credential-management/#algorithm-request): the stored password or federated credentials chosen by the user (UserAgentUIBackend.ChooseCredentialAsync) when CredentialRequestOptions.Password or CredentialRequestOptions.Federated is set, or a Web Authentication assertion when CredentialRequestOptions.PublicKey is set. The task fails with an InvalidStateError DomException when the document is not fully active, a NotSupportedError when the options request no supported type of credential or a combination of types that cannot be requested together, a NotAllowedError when the document is not allowed to use the feature of the type, a request is already pending or the document is in a frame that is not same origin with its ancestors (password and federated credentials), and the errors of the ceremony.
public Task<Credential?> Get(CredentialRequestOptions? options = null)PreventSilentAccess()
CredentialsContainer.csPrevents the silent access to the credentials of the origin of the document (https://w3c.github.io/webappsec-credential-management/#dom-credentialscontainer-preventsilentaccess): the origin requires user mediation (CredentialChooserPrompt.RequiresUserMediation) until the user chooses a credential. The task fails with an InvalidStateError DomException when the document is not fully active.
public Task PreventSilentAccess()Store(Credential)
CredentialsContainer.csStores a credential (https://w3c.github.io/webappsec-credential-management/#algorithm-store): the user is asked whether to save a password or federated credential (UserAgentUIBackend.StoreCredentialAsync), and the task completes whatever the answer. The task fails with a NotAllowedError DomException when the document is in a frame that is not same origin with its ancestors, a SecurityError when the origin of the credential is not the origin of the document, and a NotSupportedError for the other types of credentials (the public key credentials cannot be stored).
public Task Store(Credential credential)