prompt=login
mechanism can be subverted by simply stripping the parameter as it passes through the user agent (browser) and is only good for providing a UX hint to the provider (OP) in cases when the (RP) wants to display a link like:
“Hi Josh. Not you? Click here.”
However, you should not rely on it to validate that a fresh authentication took place. To mitigate this, the client must validate that re-authentication has taken place using the auth_time
claim if re-authentication is whymax_age
was requested. This claim will be included automatically in the when prompt-login
or max_age=0
parameters are given in the authentication request.
You need to pass the max_age
parameter to the Authorization API /authorize
endpoint. If you use Auth0.js or Lock, you can set the parameter in the appropriate options of the library.
How you implement re-authentication depends on your specific use-case. Make a distinction between simple re-authentication for sensitive operations vs. step-up (i.e. ) for sensitive operations. Both are valid security measures. The former requires the end user to re-enter their password, whereas the latter requires them to use a pre-configured means of multifactor authentication as well.
prompt=login
parameter that can be used to trigger re-authentication UI (usually a login prompt):
login_required
.prompt=login
parameter and the RP doesn’t know the difference in the fields contained in the ID token.
Here’s a diagram of a simplified implicit flow using the prompt=login
parameter:
prompt=login
parameter and the re-authentication step can be skipped:
prompt=login
has actually yielded a re-authentication.
prompt=login
, the max_age
authentication request parameter provides a mechanism whereby RPs can positively confirm that re-authentication has taken place within a given time interval. The OIDC spec states:
max_age
request parameter corresponds to the OpenID 2.0 PAPE max_auth_age
request parameter.) When max_age
is used, the ID token returned must include an auth_time
claim value.max_age
is requested by the RP, an auth_time
claim must be present in the RP. This means that max_age
can be used in one of two ways:
max_age
with a value. These are defined in seconds.max_age
parameter and the AS will force a fresh login.auth_time
claim in the ID token to determine whether or not the max_age
parameter it requested was fulfilled. In this way, the max_age=0
parameter is impervious to the same kind of client tampering that could subvert the prompt=login
parameter.
auth_time
. This extra validation will need to be covered by application authors and frameworks making use of the max_age
parameter.max_age
parameter as a way to positively confirm a re-authentication has taken place, but prompt=login
does not. This does not present very secure options if you want to force a re-authentication:
prompt
parameter and not validate that the AS actually re-authenticated.max_age
such that an auth_time
claim is present. You can validate a re-authentication took place, but the parameters get messy.max_age
parameter. Note that a recent spec update further clarified this parameter, stating it is effectively the same as prompt=login
. This one is not feasible since it blends what should be a UX parameter with a session maintenance parameter.auth_time
claim in the ID token when responding to aprompt=login
request parameter. This means that you have the option use prompt=login
AND validate that a re-authentication took place.
auth_time
has been returned.max_age=0
option to the Auth0OidcStrategy
:
max_age
parameter:
prompt=login
in the same context, but since the standard does not require an auth_time
to accompany the ID token response, you must handle the validation manually. So, the strategy constructor would be:
max_age=0
, the client must manually perform validation on the auth_time
parameter. To learn more, read Use auth_time claims.
auth_time
claim to ensure auth_time
is a later timestamp.auth_time
.
Forcing re-authentication within the upstream identity provider is not something Auth0 supports because not all providers support this.
The diagram below presents an example flow for a user who chooses to reauthenticate with a federated connection:
prompt=login
or prompt=consent
is generally a way to indicate an external (social) identity provider to reauthenticate a user, but Auth0 cannot enforce this.
auth_time
to prevent sensitive operations.