Categorygithub.com/eko/authz/backend
module
0.8.3
Repository: https://github.com/eko/authz.git
Documentation: pkg.go.dev

# README

Authz - Backend

This is the backend server of Authz.

Written in Go, it brings:

  • an HTTP API server (default port: 8080)
  • a gRPC API server (default port: 8081)

Pre-requisites

In order to launch the backend server, you need to have a database running. Please refer to root README.md file.

How to run

You can simply run it with:

$ go run cmd/main.go

Configuration

Here are the available configuration options available as environment variable:

PropertyDefault valueDescription
APP_AUDIT_CLEAN_DAYS_TO_KEEP7Audit logs number of days to keep in database
APP_AUDIT_CLEAN_DELAY1hAudit logs clean delay
APP_AUDIT_FLUSH_DELAY3sDelay in which audit logs will be batch into database
APP_AUDIT_RESOURCE_KIND_REGEX.*Filter which resource kind will be added on audit logs
APP_METRICS_ENABLEDfalseEnable Prometheus metrics observability (available under /v1/metrics URL)
APP_TRACE_ENABLEDfalseEnable tracing observability using OpenTelemetry
APP_TRACE_EXPORTERjaegerExporter you want to use. Could be jaeger, zipkin or otlpgrpc
APP_TRACE_JAEGER_URLhttp://localhost:14268/api/tracesJaeger API URL to be used
APP_TRACE_OTLP_DIAL_TIMEOUT3sOTLP gRPC exporter dial timeout value
APP_TRACE_OTLP_ENDPOINTlocalhost:30080OTLP gRPC endpoint value
APP_TRACE_SAMPLE_RATIO1.0Sampling ratio value defines how many traces should be sent to your exporter
APP_TRACE_ZIPKIN_URLhttp://localhost:9411/api/v2/spansZipkin API URL to be used
APP_STATS_CLEAN_DAYS_TO_KEEP30Statistics number of days to keep in database
APP_STATS_CLEAN_DELAY1hStatistics clean delay
APP_STATS_FLUSH_DELAY3sDelay in which statistics will be batch into database
APP_STATS_RESOURCE_KIND_REGEX.*Filter which resource kind will be added on statistics
AUTH_ACCESS_TOKEN_DURATION6hAccess token duration
AUTH_DOMAINhttp://localhost:8080OAuth domain to be used
AUTH_JWT_SIGN_STRING4uthz-s3cr3t-valu3-pl3as3-ch4ng3!Default HMAC to use for JWT tokens
AUTH_REFRESH_TOKEN_DURATION6hRefresh token duration
DATABASE_DRIVERpostgresDatabase driver (mysql, postgres or sqlite)
DATABASE_HOSTlocalhostDatabase host
DATABASE_NAMErootDatabase name
DATABASE_PASSWORDtoorDatabase password
DATABASE_PORT5432Database port
DATABASE_SSLdisableShould database SSL mode be enabled?
DATABASE_TIMEZONEUTCDatabase timezone for date/time
DATABASE_USERrootDatabase user
DISPATCHER_EVENT_CHANNEL_SIZE10000Event dispatcher channel size
GRPC_SERVER_ADDR:8081gRPC server address (hostname and port)
HTTP_SERVER_ADDR:8080HTTP server address (hostname and port)
HTTP_SERVER_CORS_ALLOW_CREDENTIALStrueShould CORS allow credentials requests?
HTTP_SERVER_CORS_ALLOWED_DOMAINShttp://localhost:3000CORS allowed domains
HTTP_SERVER_CORS_ALLOWED_HEADERSAuthorization,Origin,Content-Length,Content-TypeCORS allowed headers
HTTP_SERVER_CORS_ALLOWED_METHODSGET,POST,PATCH,PUT,DELETE,HEAD,OPTIONSCORS allowed methods
HTTP_SERVER_CORS_CACHE_MAX_AGE12hCORS cache max age value to be returned by server
LOGGER_LEVELINFOLog level, could be DEBUG, INFO, WARN or ERROR
USER_ADMIN_DEFAULT_PASSWORDchangemeDefault admin password updated on app launch
OAUTH_CLIENT_IDN/AOAuth client ID provided by your issuer
OAUTH_CLIENT_SECRETN/AOAuth client Secret provider by your issuer
OAUTH_COOKIES_DOMAIN_NAMElocalhostOAuth domain name on which cookies will be stored
OAUTH_FRONTEND_REDIRECT_URLhttp://localhost:3000Frontend redirect URL when OAuth authentication is successful
OAUTH_ISSUER_URLN/AIssuer OpenID Connect URL (will be used to retrieve /.well-known/openid-configuration)
OAUTH_REDIRECT_URL[12h](http://localhost:8080/v1/oauth/callback)Backend OAuth callback URL
OAUTH_SCOPESprofile,emailOAuth scopes to be retrieved from your issuer

Tests

Unit tests

You can run Go unit tests with:

$ make test-unit

Functional tests

You can run HTTP API functional tests with:

$ make test-functional [tags=<something>]

Giving a tag is optionnal, it allows to run a specific tagged resource only.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author