Konfiguration

1. per .ini-Datei

[API]
endpoint = https://users.locr.com/api/
http-auth-enabled = false ; true oder false
http-auth-type = basic ; basic oder digest
http-auth-username =
http-auth-password =
ssl-verifyhost = 2 ; 0, 1 oder 2
ssl-verifypeer = true ; true oder false

[COOKIE]
name = X-LOCR-USER-TOKEN
expires = 0 ; in Sekunden (0 => session cookie) oder als DateInterval-String wie unter https://www.php.net/manual/de/dateinterval.createfromdatestring.php beschrieben.

[JWT]
issuer = https://users.locr.com/
audience = https://users.locr.com/
secret = ; Kann per `echo '<?php print base64_encode(random_bytes(32));' | php` generiert werden.
signature-algorithm = HS256 ; EdDSA, HS256, HS384, HS512, RS256, ..., ES256, ..., PS256, ..., none
expiration = 3600 ; in Sekunden oder als DateInterval-String wie unter https://www.php.net/manual/de/dateinterval.createfromdatestring.php beschrieben.

[TOKEN]
type = jwt
destination = local_directory
directory = /var/lib/locr/tokens/jwt
id-generator = uuid4 ; uuid1, uuid4, uuid6, uuid7, random_bytes oder openssl_random_pseudo_bytes

2. per Umgebungsvariablen

export LOCR_USER_CLIENT_API_ENDPOINT=https://users.locr.com/api/
export LOCR_USER_CLIENT_API_HTTP_AUTH_ENABLED=false
export LOCR_USER_CLIENT_API_HTTP_AUTH_TYPE=basic
export LOCR_USER_CLIENT_API_HTTP_AUTH_USERNAME=
export LOCR_USER_CLIENT_API_HTTP_AUTH_PASSWORD=
export LOCR_USER_CLIENT_API_SSL_VERIFYHOST=2
export LOCR_USER_CLIENT_API_SSL_VERIFYPEER=true

export LOCR_USER_CLIENT_COOKIE_NAME=X-LOCR-USER-TOKEN
export LOCR_USER_CLIENT_COOKIE_EXPIRES=0

export LOCR_USER_CLIENT_JWT_ISSUER=https://users.locr.com/
export LOCR_USER_CLIENT_JWT_AUDIENCE=https://users.locr.com/
export LOCR_USER_CLIENT_JWT_SECRET=
export LOCR_USER_CLIENT_JWT_SIGNATURE_ALGORITHM=HS256
export LOCR_USER_CLIENT_JWT_EXPIRATION=3600

export LOCR_USER_CLIENT_TOKEN_TYPE=jwt
export LOCR_USER_CLIENT_TOKEN_DESTINATION=local_directory
export LOCR_USER_CLIENT_TOKEN_DIRECTORY=/var/lib/locr/tokens/jwt
export LOCR_USER_CLIENT_TOKEN_ID_GENERATOR=uuid4

3. per PHP Array

$config = [
    'API' => [
        'endpoint' => 'https://users.locr.com/api/',
        'http-auth' => [
            'enabled' => false,
            'type' => 'basic',
            'username' => '',
            'password' => ''
        ],
        'ssl-verifyhost' => 2,
        'ssl-verifypeer' => true,
    ],
    'COOKIE' => [
        'name' => 'X-LOCR-USER-TOKEN',
        'expires' => 0,
    ],
    'JWT' => [
        'issuer' => 'https://users.locr.com/',
        'audience' => 'https://users.locr.com/',
        'secret' => '',
        'signature-algorithm' => 'HS256',
        'expiration' => 3600,
    ],
    'TOKEN' => [
        'type' => 'jwt',
        'destination' => 'local_directory',
        'directory' => '/var/lib/locr/tokens/jwt',
        'id-generator' => 'uuid4',
    ],
];