Skip to main content

Authentication Overview

Keyline supports dual authentication methods simultaneously: OIDC (OpenID Connect) for interactive browser users and Basic Auth for programmatic access. This guide provides an overview of both authentication methods and how Keyline handles them.

Supported Authentication Methods

MethodUse CaseSessionBest For
OIDCInteractive browser authenticationYes (cookie-based)Human users, SSO
Basic AuthProgrammatic/API accessNo (stateless)CI/CD, monitoring, scripts

Dual Authentication Architecture

Keyline automatically selects the appropriate authentication method based on the incoming request:

Authentication Flow Comparison

OIDC Flow (Interactive Users)

Basic Auth Flow (Programmatic Access)

Key Security Features

OIDC Security

FeaturePurpose
PKCEPrevents authorization code interception attacks
State TokenCSRF protection, single-use, 5-minute TTL
ID Token ValidationSignature, issuer, audience, expiration checks
JWKS RotationAutomatic key refresh every 24 hours
Secure CookiesHttpOnly, Secure, SameSite=Lax attributes

Basic Auth Security

FeaturePurpose
Bcrypt HashingTiming-safe password comparison
No Session StorageStateless authentication
WWW-Authenticate HeaderProper 401 response for failed auth
No Plaintext LoggingCredentials never logged

Session Management

AttributeValuePurpose
HttpOnlytruePrevents JavaScript access (XSS protection)
SecuretrueRequires HTTPS transmission
SameSiteLaxPrevents CSRF attacks
Max-AgeConfigurable (default: 24h)Session TTL

Session Storage Backends

BackendUse CaseProsCons
MemoryDevelopment, single-nodeSimple, no dependenciesLost on restart, no scaling
RedisProduction, multi-nodePersistent, scalableRequires Redis infrastructure

Configuration Summary

OIDC Configuration

oidc:
enabled: true
issuer_url: https://accounts.google.com
client_id: ${OIDC_CLIENT_ID}
client_secret: ${OIDC_CLIENT_SECRET}
redirect_url: https://auth.example.com/auth/callback
scopes:
- openid
- email
- profile

Basic Auth Configuration

local_users:
enabled: true
users:
- username: ci-pipeline
password_bcrypt: ${CI_PASSWORD_BCRYPT}
groups:
- ci
email: ci@example.com
full_name: CI Pipeline

Session Configuration

session:
ttl: 24h
cookie_name: keyline_session
cookie_domain: .example.com
session_secret: ${SESSION_SECRET} # Min 32 bytes

Authentication Endpoints

EndpointMethodPurpose
/_authGETForwardAuth validation endpoint
/auth/callbackGETOIDC callback handler
/auth/logoutGET/POSTSession logout
/*ANYProtected resources

Next Steps