Proxy Authorization

Proxies can integrate with Authelia via several authorization endpoints. These endpoints are by default configured appropriately for most use cases; however they can be individually configured, removed, added, etc.

They are currently divided into two sections:

These endpoints are meant to collect important information from these requests via headers to determine both metadata about the request (such as the resource and IP address of the user) which is determined via the Implementations, and the identity of the user which is determined via the Authn Strategies.

Default Endpoints

NamePathImplementationAuthn Strategies
forward-auth/api/authz/forward-authForwardAuthHeaderAuthorization, CookieSession
ext-authz/api/authz/ext-authzExtAuthzHeaderAuthorization, CookieSession
auth-request/api/authz/auth-requestAuthRequestHeaderAuthorization, CookieSession
legacy/api/verifyLegacyHeaderLegacy, CookieSession

Metadata

Various metadata is collected from the request made to the Authelia authorization server. This table describes the metadata collected. All of this metadata is utilized for the purpose of determining if the user is authorized to a particular resource.

NameDescription
MethodThe Method Verb of the Request
SchemeThe URI Scheme of the Request
HostnameThe URI Hostname of the Request
PathThe URI Path of the Request
IPThe IP address of the client making the Request
Authelia URLThe URL of the Authelia Portal

Some values may have either fallbacks or override values. If they exist they will be in the alternatives table which will be below the main metadata table.

The metadata table contains the recommended source of this information and this source is often times automatic depending on the proxy implementation. The difference between an override and a fallback is an override values will take precedence over the metadata values, and fallbacks only take effect if the override values or metadata values are completely unset.

Implementations

ForwardAuth

This is the implementation which supports Traefik via the ForwardAuth Middleware, Caddy via the forward_auth directive, HAProxy via the auth-request lua plugin, and Skipper via the webhook auth filter.

ForwardAuth Metadata

MetadataSourceKey
Method 1HeaderX-Forwarded-Method 2
Scheme 1HeaderX-Forwarded-Proto 2
Hostname 1HeaderX-Forwarded-Host 2
Path 1HeaderX-Forwarded-URI 2
IP 1HeaderX-Forwarded-For 3
Authelia URL 1Session Cookie Configurationauthelia_url

ForwardAuth Metadata Alternatives

MetadataAlternative TypeSourceKey
Scheme 1FallbackHeaderServer Scheme
IP 1FallbackTCP PacketSource IP
Authelia URL 1OverrideQuery Argumentauthelia_url

ExtAuthz

This is the implementation which supports Envoy via the HTTP ExtAuthz Filter.

ExtAuthz Metadata

MetadataSourceKey
Method 1Start LineHTTP Method 2
Scheme 1HeaderX-Forwarded-Proto 2
Hostname 1HeaderHost 2
Path 1HeaderEndpoint Sub-Path 2
IP 1HeaderX-Forwarded-For 2
Authelia URL 1Session Cookie Configurationauthelia_url

ExtAuthz Metadata Alternatives

MetadataAlternative TypeSourceKey
Scheme 1FallbackHeaderServer Scheme
IP 1FallbackTCP PacketSource IP
Authelia URL 1OverrideHeaderX-Authelia-URL

AuthRequest

This is the implementation which supports NGINX via the auth_request HTTP module, and can technically support HAProxy via the auth-request lua plugin.

AuthRequest Metadata

MetadataSourceKey
Method 1HeaderX-Original-Method 2
Scheme 1HeaderX-Original-URL 2
Hostname 1HeaderX-Original-URL 2
Path 1HeaderX-Original-URL 2
IP 1HeaderX-Forwarded-For 3
Authelia URL 1Session Cookie Configurationauthelia_url

Note

This endpoint does not support automatic redirection. This is because there is no support on NGINX’s side to achieve this with ngx_http_auth_request_module and the redirection must be performed within the NGINX configuration. However, we return the appropriate URL to redirect users to with the Location header which simplifies this process especially for multi-cookie domain deployments.

AuthRequest Metadata Alternatives

MetadataAlternative TypeSourceKey
IP 1FallbackTCP PacketSource IP
Authelia URL 1OverrideQuery Argumentauthelia_url

Legacy

This is the legacy implementation which used to operate similar to both the ForwardAuth and AuthRequest implementations.

Note

This implementation has duplicate entries for metadata. This is due to the fact this implementation used to cater for the AuthRequest and ForwardAuth implementations. The table is in order of precedence where if a header higher in the list exists it is used over those lower in the list.

MetadataSourceKey
Method 1HeaderX-Original-Method
Scheme 1HeaderX-Original-URL
Hostname 1HeaderX-Original-URL
Path 1HeaderX-Original-URL
Method 1HeaderX-Forwarded-Method
Scheme 1HeaderX-Forwarded-Proto
Hostname 1HeaderX-Forwarded-Host
Path 1HeaderX-Forwarded-URI
IP 1HeaderX-Forwarded-For
Authelia URL 1Query Argumentrd
Authelia URL 1HeaderX-Authelia-URL

Authn Strategies

Authentication strategies are used to determine the users identity which is essential to determining if they are authorized to visit a particular resource. Authentication strategies are executed in order, and have three potential results.

  1. Successful Authentication
    • This result occurs when the required metadata i.e. headers are in the request for the strategy and they can be validated.
    • This result causes a short-circuit which generally results in a 200 OK.
  2. Unsuccessful Authentication
    • This result occurs when the required metadata i.e. headers are in the request for the strategy and they can not be validated as they are either explicitly invalid or the means of validation could not be attempted due to an error.
    • This result causes a short-circuit applying the failure action and no other strategies will be attempted.
  3. No Authentication
    • This result occurs when the required metadata i.e. headers are absent from the request for the strategy.
    • This result does not cause a short-circuit and:
      1. The next strategy will be attempted.
      2. If there is no next strategy the failure action will be applied.

CookieSession

Failure Action: Redirect the user for authentication.

Metadata: Cookie header value, considered absent when the configured cookie key is absent from this header or the header is absent.

This strategy uses a cookie which links the user to a session to determine the users identity. This is the default strategy for end-users.

HeaderAuthorization

Failure Action: Responds with the WWW-Authenticate header and a 401 Unauthorized status code.

Metadata: Authorization header, considered absent when the header is absent.

This strategy uses the Authorization header to determine the users’ identity.

HeaderProxyAuthorization

Failure Action: Responds with the Proxy-Authenticate header and a 407 Proxy Authentication Required status code.

Metadata: Proxy-Authorization header, considered absent when the header is absent.

This strategy uses the Proxy-Authorization header to determine the users’ identity.

HeaderAuthRequestProxyAuthorization

Failure Action: Responds with the WWW-Authenticate header and a 401 Unauthorized status code.

Metadata: Proxy-Authorization header, considered absent when the header is absent.

This strategy uses the Proxy-Authorization header to determine the users’ identity. It is specifically intended for use with the AuthRequest implementation.

HeaderLegacy

Failure Action: Responds with the WWW-Authenticate header and a 401 Unauthorized status code.

Metadata: Proxy-Authorization header, considered absent when the header is absent.

This strategy uses the Proxy-Authorization header to determine the users’ identity.

Footnotes


  1. This is considered required metadata, and must either be provided via the primary metadata source or the alternative source for the request to be considered valid. ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎

  2. This is considered a required header. If an alternative or fallback source is described this is very likely to be incorrect and cannot be supported. ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎ ↩︎

  3. This header is not required but the fallback is likely desirable in most scenarios. ↩︎ ↩︎