Custom

Allows you to specify your own logic controlling how auth tokens should be extracted and validated. This, like the custom provider, utilizes Yaegi to allow you to supply your own custom code.

To help mitigate the performance impact of calling the interpreted validate method, a cache is utilized by default. In turn, to avoid concurrent requests that utilize the same token from causing repetitive calls to validate, a pool of locks are utilized when the cache is enabled. The size of the lock pool is equal to the number of CPUs.

For more details on implementing the code for a custom authentication, see Extensibility

Name should be "custom"

Configuration options:

Parameter Description Type Required Default

token

How to extract the auth token from the request. Each Key/Value should be one of the options in the table above

map[string]string

Yes

None

cachesize

Configures the size of the cache of already verified tokens used to avoid re-verifying every request. Set to -1 to disable

int

No

100

file

Contains the path to the file containing the go code to perform validation of the auth token as a file

string

No

None

Example:

authentication:
  name: custom
  file: examples/auth/custom_from_file.go
  token:
    header: X-Token