Skip to content

Commit c3d11d2

Browse files
authored
Merge pull request #25 from probitas-test/fix/http/doc
Complete echo-http environment variable documentation
2 parents 95c56e8 + f8d1196 commit c3d11d2

File tree

4 files changed

+22
-27
lines changed

4 files changed

+22
-27
lines changed

echo-http/config.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ type Config struct {
2828
AuthCodeSessionTTL int
2929
AuthCodeValidateRedirectURI bool
3030
AuthCodeAllowedRedirectURIs string
31-
32-
// OIDC Configuration (id_token specific)
33-
OIDCEnableJWTSigning bool
3431
}
3532

3633
func LoadConfig() *Config {
@@ -46,7 +43,7 @@ func LoadConfig() *Config {
4643
AuthAllowedClientSecret: getEnv("AUTH_ALLOWED_CLIENT_SECRET", ""),
4744
AuthSupportedScopes: parseScopes(getEnv("AUTH_SUPPORTED_SCOPES", "openid,profile,email")),
4845
AuthTokenExpiry: getIntEnv("AUTH_TOKEN_EXPIRY", 3600),
49-
AuthAllowedGrantTypes: parseGrantTypes(getEnv("AUTH_ALLOWED_GRANT_TYPES", "authorization_code,client_credentials")),
46+
AuthAllowedGrantTypes: parseGrantTypes(getEnv("AUTH_ALLOWED_GRANT_TYPES", "authorization_code,client_credentials,password,refresh_token")),
5047

5148
// Resource Owner Password Credentials / Basic Auth settings
5249
AuthAllowedUsername: getEnv("AUTH_ALLOWED_USERNAME", "testuser"),
@@ -57,9 +54,6 @@ func LoadConfig() *Config {
5754
AuthCodeSessionTTL: getIntEnv("AUTH_CODE_SESSION_TTL", 300),
5855
AuthCodeValidateRedirectURI: getBoolEnv("AUTH_CODE_VALIDATE_REDIRECT_URI", false),
5956
AuthCodeAllowedRedirectURIs: getEnv("AUTH_CODE_ALLOWED_REDIRECT_URIS", ""),
60-
61-
// OIDC settings (id_token specific)
62-
OIDCEnableJWTSigning: getBoolEnv("OIDC_ENABLE_JWT_SIGNING", false),
6357
}
6458
}
6559

echo-http/docs/api.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,28 @@
1919
| `HOST` | `0.0.0.0` | Bind address |
2020
| `PORT` | `80` | Listen port |
2121

22+
### Authentication Configuration
23+
24+
Shared credentials used across all authentication methods.
25+
26+
| Variable | Default | Description |
27+
| ------------------------ | ---------- | -------------------------------------------------------------- |
28+
| `AUTH_ALLOWED_USERNAME` | `testuser` | Username for Basic Auth, Bearer Token, and OAuth2/OIDC flows |
29+
| `AUTH_ALLOWED_PASSWORD` | `testpass` | Password for Basic Auth, Bearer Token, and OAuth2/OIDC flows |
30+
2231
### OAuth2/OIDC Configuration
2332

2433
Configure OAuth2/OIDC server behavior with these environment variables:
2534

2635
**OAuth2 Configuration (shared across all flows):**
2736

28-
| Variable | Default | Description |
29-
| ---------------------------- | ----------------------- | ---------------------------------------------- |
30-
| `AUTH_ALLOWED_CLIENT_ID` | (empty - accept any) | Allowed client_id for validation (empty = any) |
31-
| `AUTH_ALLOWED_CLIENT_SECRET` | (empty - public client) | Required client_secret (empty = not required) |
32-
| `AUTH_SUPPORTED_SCOPES` | `openid,profile,email` | Comma-separated list of supported scopes |
33-
| `AUTH_TOKEN_EXPIRY` | `3600` | Access token expiry in seconds |
37+
| Variable | Default | Description |
38+
| ---------------------------- | ----------------------------------------------------------------- | ---------------------------------------------- |
39+
| `AUTH_ALLOWED_CLIENT_ID` | (empty - accept any) | Allowed client_id for validation (empty = any) |
40+
| `AUTH_ALLOWED_CLIENT_SECRET` | (empty - public client) | Required client_secret (empty = not required) |
41+
| `AUTH_SUPPORTED_SCOPES` | `openid,profile,email` | Comma-separated list of supported scopes |
42+
| `AUTH_TOKEN_EXPIRY` | `3600` | Access token expiry in seconds |
43+
| `AUTH_ALLOWED_GRANT_TYPES` | `authorization_code,client_credentials,password,refresh_token` | Comma-separated list of allowed grant types |
3444

3545
**Authorization Code Flow Configuration:**
3646

@@ -41,12 +51,6 @@ Configure OAuth2/OIDC server behavior with these environment variables:
4151
| `AUTH_CODE_VALIDATE_REDIRECT_URI` | `false` | Enable redirect_uri validation |
4252
| `AUTH_CODE_ALLOWED_REDIRECT_URIS` | (empty - allow all) | Comma-separated redirect URI patterns |
4353

44-
**OIDC Configuration (id_token specific):**
45-
46-
| Variable | Default | Description |
47-
| ------------------------- | ------- | ---------------------------------------------- |
48-
| `OIDC_ENABLE_JWT_SIGNING` | `false` | Enable JWT signing (currently not implemented) |
49-
5054
**Example Configuration:**
5155

5256
```bash
@@ -55,6 +59,7 @@ export AUTH_ALLOWED_CLIENT_ID=my-app-client-id
5559
export AUTH_ALLOWED_CLIENT_SECRET=my-app-secret
5660
export AUTH_SUPPORTED_SCOPES=openid,profile,email,custom_scope
5761
export AUTH_TOKEN_EXPIRY=3600
62+
export AUTH_ALLOWED_GRANT_TYPES=authorization_code,client_credentials,password,refresh_token
5863
export AUTH_CODE_REQUIRE_PKCE=true
5964
export AUTH_CODE_VALIDATE_REDIRECT_URI=true
6065
export AUTH_CODE_ALLOWED_REDIRECT_URIS=http://localhost:*,https://myapp.com/callback
@@ -489,8 +494,8 @@ Validate Basic Authentication credentials.
489494

490495
Configure credentials via environment variables:
491496

492-
- `AUTH_ALLOWED_USERNAME`: Expected username
493-
- `AUTH_ALLOWED_PASSWORD`: Expected password
497+
- `AUTH_ALLOWED_USERNAME`: Expected username (default: `testuser`)
498+
- `AUTH_ALLOWED_PASSWORD`: Expected password (default: `testpass`)
494499

495500
**Request:**
496501

@@ -515,8 +520,8 @@ Validate Bearer token authentication. The expected token is SHA1(username:passwo
515520

516521
Configure credentials via environment variables:
517522

518-
- `AUTH_ALLOWED_USERNAME`: Username
519-
- `AUTH_ALLOWED_PASSWORD`: Password
523+
- `AUTH_ALLOWED_USERNAME`: Username (default: `testuser`)
524+
- `AUTH_ALLOWED_PASSWORD`: Password (default: `testpass`)
520525

521526
Generate the token:
522527

echo-http/handlers/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ type Config struct {
2222
AuthCodeSessionTTL int
2323
AuthCodeValidateRedirectURI bool
2424
AuthCodeAllowedRedirectURIs string
25-
26-
// OIDC Configuration (id_token specific)
27-
OIDCEnableJWTSigning bool
2825
}
2926

3027
// SetConfig sets the global configuration for handlers.

echo-http/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ func main() {
3333
AuthCodeSessionTTL: cfg.AuthCodeSessionTTL,
3434
AuthCodeValidateRedirectURI: cfg.AuthCodeValidateRedirectURI,
3535
AuthCodeAllowedRedirectURIs: cfg.AuthCodeAllowedRedirectURIs,
36-
OIDCEnableJWTSigning: cfg.OIDCEnableJWTSigning,
3736
})
3837

3938
r := chi.NewRouter()

0 commit comments

Comments
 (0)