pta_auth_method

The `pta_auth_method` directive specifies the authentication method used by the Period of Time Authentication module in NGINX.

Syntaxpta_auth_method qs | cookie | qs cookie;
Defaultqs
Contextlocation
Arguments1+

Description

The pta_auth_method directive allows users to define how authentication is performed within specific location blocks of an NGINX configuration. It accepts one or more arguments, corresponding to different authentication methods: 'qs' for query string or 'cookie' for cookie-based authentication. This flexibility enables the module to effectively accommodate various requirements for secure access based on the context in which it is deployed.

When the pta_auth_method directive is set to 'qs', the module expects the authentication parameters to be encoded within a query string, typically appended to the URL when a request is made. Conversely, if 'cookie' is selected, the authentication information is expected to be stored in cookies set on the client side. Additionally, both methods can be combined by specifying both options, enabling NGINX to accept authentication data from either source, providing greater versatility.

Regardless of the chosen method, the authentication process involves decrypting the relevant parameters, checking their integrity with CRC32, validating the expiration time, and ensuring the requested path matches the one embedded in the authentication data. This multi-faceted approach ensures that only legitimate requests are granted access, thus enhancing security.

Config Example

location /protected {
    pta_enable on;
    pta_auth_method qs cookie;
}

Ensure that at least one authentication method is specified to prevent access issues.

Test both query string and cookie methods when both are enabled to ensure compatibility.

Verify that the keys and initialization vectors are correctly set up in the configuration.

← Back to all directives