Minor changes

This commit is contained in:
David Allen 2024-02-25 10:00:55 -07:00
parent dcfd9b5906
commit 4bfadc57bc
No known key found for this signature in database
GPG key ID: 1D2A29322FBB6FCB
3 changed files with 9 additions and 19 deletions

View file

@ -1,16 +0,0 @@
networks:
- name: hardware_management
subnet: 10.10.10.10/24
- name: system_management
subnet: 10.10.10.10/24
- name: high_speed
subnet: 192.168.1.128/24
databases:
- name: hydradb
users:
- name: hydra-user
password: hydra
- name: kratosdb
users:
- name: kratos-user
password: kratos

View file

@ -12,6 +12,7 @@ volumes:
services:
hydra:
image: oryd/hydra:v2.2.0
container_name: hydra
ports:
- "4444:4444" # Public port
- "4445:4445" # Admin port
@ -85,6 +86,7 @@ services:
depends_on:
- kratos-migrate
image: oryd/kratos:v1.1.0
container_name: kratos
ports:
- '4433:4433' # public
- '4434:4434' # admin

View file

@ -83,7 +83,7 @@ func Login(config *Config) error {
// unmarshal data to get id_token and access_token
var data map[string]any
err = json.Unmarshal([]byte(tokenString), &data)
if err != nil {
if err != nil || data == nil {
return fmt.Errorf("failed to unmarshal token: %v", err)
}
@ -128,6 +128,7 @@ func Login(config *Config) error {
if err != nil {
return fmt.Errorf("failed to fetch identities: %v", err)
}
fmt.Printf("Created new identity successfully.\n")
}
// extract the subject from ID token claims
@ -160,13 +161,16 @@ func Login(config *Config) error {
fmt.Printf("Fetching JWKS from authentication server for verification...\n")
err = idp.FetchJwk(config.ActionUrls.JwksUri)
if err != nil {
fmt.Printf("failed to fetch JWK: %v\n", err)
return fmt.Errorf("failed to fetch JWK: %v\n", err)
} else {
fmt.Printf("Attempting to add issuer to authorization server...\n")
_, err = client.AddTrustedIssuer(config.ActionUrls.TrustedIssuers, idp, subject, time.Duration(1000), config.Scope)
res, err := client.AddTrustedIssuer(config.ActionUrls.TrustedIssuers, idp, subject, time.Duration(1000), config.Scope)
if err != nil {
return fmt.Errorf("failed to add trusted issuer: %v", err)
}
if string(res) == "" {
fmt.Printf("Added issuer to authorization server successfully.\n")
}
}
// use ID token/user info to fetch access token from authentication server