add: login & token validation tapi belum connect ke DB

This commit is contained in:
mario
2025-05-05 11:50:36 +07:00
parent 297c9a6a01
commit 6c9ab574ce
16 changed files with 1009 additions and 41 deletions

View File

@@ -26,6 +26,21 @@ type Config struct {
CredentialsPath string `mapstructure:"credentials_path"`
} `mapstructure:"google"`
Auth struct {
JWTSecret string `mapstructure:"jwt_secret"`
AccessTokenExpiry int `mapstructure:"access_token_expiry"` // in minutes
RefreshTokenExpiry int `mapstructure:"refresh_token_expiry"` // in hours
EnableDatabaseAuth bool `mapstructure:"enable_database_auth"`
} `mapstructure:"auth"`
Database struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
User string `mapstructure:"user"`
Password string `mapstructure:"password"`
Name string `mapstructure:"name"`
} `mapstructure:"database"`
AllowedOrigins []string `mapstructure:"allowed_origins"`
}

View File

@@ -13,5 +13,18 @@ google:
dicom_store: "store-1" # Your DICOM store name
credentials_path: "./credentials/service-account.json"
auth:
jwt_secret: "vQ6PQqUyh7pBNOytClgN+Nw1XBq7F8Qo6VP3VwIqvHY=" # Change this in production!
access_token_expiry: 1440 # minutes (24 hours)
refresh_token_expiry: 168 # hours (7 days)
enable_database_auth: false # Set to true when ready to use database
database:
host: "localhost"
port: 3306
user: "dbuser"
password: "dbpassword" # Consider using environment variables for sensitive data
name: "ohif_proxy"
allowed_origins:
- "*" # For development; restrict this in production