Add configurable JWT expiration time config option #89
|
@ -26,6 +26,7 @@ BACKEND_URL=URL
|
|||
# Backend - API
|
||||
BACKEND_API_GRAPHQL_PLAYGROUND=false
|
||||
BACKEND_API_JWT_SECRET=
|
||||
BACKEND_API_JWT_EXPIRATION=360
|
||||
# Backend - Worker
|
||||
# Backend - SMTP
|
||||
BACKEND_SMTP_HELO=
|
||||
|
|
|
@ -79,6 +79,7 @@ services:
|
|||
BACKEND_URL: ${URL}
|
||||
BACKEND_API_GRAPHQL_PLAYGROUND: ${BACKEND_API_GRAPHQL_PLAYGROUND}
|
||||
BACKEND_API_JWT_SECRET: ${BACKEND_API_JWT_SECRET}
|
||||
BACKEND_API_JWT_EXPIRATION: ${BACKEND_API_JWT_EXPIRATION}
|
||||
BACKEND_SMTP_HELO: ${BACKEND_SMTP_HELO}
|
||||
BACKEND_SMTP_HOST: ${BACKEND_SMTP_HOST}
|
||||
BACKEND_SMTP_PORT: ${BACKEND_SMTP_PORT}
|
||||
|
|
|
@ -33,7 +33,7 @@ module Backend
|
|||
user: User.new(user),
|
||||
token: Auth.create_user_jwt(
|
||||
user.id.not_nil!.to_i,
|
||||
(Time.utc + (user.admin ? Time::Span.new(hours: 6) : Time::Span.new(days: 1))).to_unix
|
||||
(Time.utc + Backend.config.api.jwt_expiration.minutes).to_unix
|
||||
),
|
||||
)
|
||||
end
|
||||
|
|
|
@ -87,6 +87,9 @@ module Backend
|
|||
# JWT signing key
|
||||
getter jwt_secret : String
|
||||
|
||||
# JWT expiration time in minutes
|
||||
getter jwt_expiration : Int32
|
||||
|
||||
# Helper method for enabling GraphQL playground
|
||||
#
|
||||
# Returns `true` if `Config#development?` or `#graphql_playground` are
|
||||
|
|
|
@ -12,19 +12,20 @@ To change the environment variables edit the `.env` file.
|
|||
| `BACKEND_URL` | `String` | Backend webroot (= `URL`) |
|
||||
| `BACKEND_API_GRAPHQL_PLAYGROUND` | `Bool` | Enables GraphQL playground (automatically enabled when compiled in development mode) |
|
||||
| `BACKEND_API_JWT_SECRET` | `String` | Password to encrypt all authentication tokens with |
|
||||
| `BACKEND_API_JWT_EXPIRATION` | `Int` | Expiration time of authentication tokens in minutes |
|
||||
| `BACKEND_SMTP_HELO` | `String` | SMTP server HELO |
|
||||
| `BACKEND_SMTP_HOST` | `String` | SMTP server hostname |
|
||||
| `BACKEND_SMTP_PORT` | `Int32` | SMTP server port (= `587`) |
|
||||
| `BACKEND_SMTP_PORT` | `Int` | SMTP server port |
|
||||
| `BACKEND_SMTP_NAME` | `String` | Name to send emails with |
|
||||
| `BACKEND_SMTP_USERNAME` | `String` | SMTP account username |
|
||||
| `BACKEND_SMTP_PASSWORD` | `String` | SMTP account password |
|
||||
| `BACKEND_LDAP_HOST` | `String` | LDAP server hostname |
|
||||
| `BACKEND_LDAP_PORT` | `Int32` | LDAP server port (= `389`) |
|
||||
| `BACKEND_LDAP_PORT` | `Int` | LDAP server port |
|
||||
| `BACKEND_LDAP_BASE_DN` | `String` | LDAP virtual DN |
|
||||
| `BACKEND_LDAP_BASE_USER_DN` | `String` | LDAP user group DN |
|
||||
| `BACKEND_LDAP_BIND_DN` | `String` | LDAP admin account DN |
|
||||
| `BACKEND_LDAP_BIND_PASSWORD` | `String` | LDAP admin account password |
|
||||
| `BACKEND_LDAP_CACHE_REFRESH_INTERVAL` | `Int32` | Periodical cache refresh interval in minutes |
|
||||
| `BACKEND_LDAP_CACHE_REFRESH_INTERVAL` | `Int` | Periodical cache refresh interval in minutes |
|
||||
|
||||
## Compile time
|
||||
|
||||
|
|
Loading…
Reference in a new issue