SAML auth method
This feature requires Vault Enterprise(opens in new tab).
The saml
auth method allows users to authentication with Vault using their identity
within a SAML V2.0 identity provider.
Authentication is suited for human users by requiring interaction with a web browser.
Authentication
The CLI login defaults to the /saml
path. If this auth method was enabled at a
different path, specify -path=/my-path
in the CLI.
The CLI opens the default browser to the generated URL where users must authenticate with the configured SAML identity provider. The URL may be manually entered into the browser if it cannot be automatically opened.
The CLI login behavior may be customized with the following optional parameters:
skip_browser
(default:false
): If set totrue
, automatic launching of the default browser will be skipped. The SAML identity provider URL must be manually entered in a browser to complete the authentication flow.abort_on_error
(default:false
): If set totrue
, the CLI returns an error and exits with a non-zero value if it cannot launch the default browser.
Configuration
Auth methods must be configured in advance before users or machines can authenticate. These steps are usually completed by an operator or configuration management tool.
Enable the SAML authentication method with the
auth enable
CLI command:Use the
/config
endpoint to save the configuration of your SAML identity provider and set the default role. You can configure the trust relationship with the SAML Identity Provider by either providing a URL for its Metadata document:or by setting the configuration Metadata manually:
Create a named role:
This role authorizes users that have a subject with an
@hashicorp.com
suffix and are in theadmin
group to authenticate. It also gives the resulting Vault token a time-to-live of 1 hour and thewriter
policy.
Refer to the SAML API documentation for a complete list of configuration options.
Assertion consumer service URLs
The acs_urls
configuration parameter determines
where the SAML response will be sent after users authenticate with the configured SAML
identity provider in their browser.
The values provided to Vault must:
- Match or be a subset of the configured values for the SAML application within the configured identity provider.
- Be directed to the auth method's assertion consumer service callback API.
Note
It is highly recommended and enforced by some identity providers to TLS-protect the assertion consumer service URLs. A warning will be returned from Vault if any of the configured assertion consumer service URLs are not protected by TLS.Configuration for replication
To support a single auth method mount being used across Vault replication
clusters, acs_urls
supports configuration of multiple values. For example, to support
SAML authentication on a primary and secondary Vault cluster, the following acs_urls
configuration could be given:
The Vault UI and CLI will automatically request the proper assertion consumer service URL for the cluster they're configured to communicate with. This means that the entirety of the authentication flow will stay within the targeted cluster.
Configuration for namespaces
The SAML auth method can be used within Vault namespaces. The assertion consumer service URLs configured in both Vault and the identity provider must include the namespace path segment.
The following table provides assertion consumer service URLs given different namespace paths:
Namespace path | Assertion consumer service URL |
---|---|
admin/ | https://my.vault/v1/admin/auth/saml/callback |
org/security/ | https://my.vault/v1/org/security/auth/saml/callback |
Bound attributes
Once the user has been authenticated the authorization flow will validate
that both the bound_subjects
and
bound_attributes
match expected
values configured for the role. This can be used to restrict access to Vault for
a subset of users in the SAML identity provider.
For example, a role with bound_subjects=*@hashicorp.com
and
bound_attributes=groups=support,engineering
will only authorize users whose subject has
an @hashicorp.com
suffix and that are in either the support
or engineering
group.
Whether it should be an exact match or interpret *
as a wildcard can be
controlled by the bound_subjects_type
and
bound_attributes_type
parameters.
API
The SAML authentication plugin has a full HTTP API. Refer to the SAML API documentation for more details.