mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-20 03:27:02 -07:00
Minor changes
This commit is contained in:
parent
dcfd9b5906
commit
4bfadc57bc
3 changed files with 9 additions and 19 deletions
|
|
@ -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
|
|
||||||
|
|
@ -12,6 +12,7 @@ volumes:
|
||||||
services:
|
services:
|
||||||
hydra:
|
hydra:
|
||||||
image: oryd/hydra:v2.2.0
|
image: oryd/hydra:v2.2.0
|
||||||
|
container_name: hydra
|
||||||
ports:
|
ports:
|
||||||
- "4444:4444" # Public port
|
- "4444:4444" # Public port
|
||||||
- "4445:4445" # Admin port
|
- "4445:4445" # Admin port
|
||||||
|
|
@ -85,6 +86,7 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
- kratos-migrate
|
- kratos-migrate
|
||||||
image: oryd/kratos:v1.1.0
|
image: oryd/kratos:v1.1.0
|
||||||
|
container_name: kratos
|
||||||
ports:
|
ports:
|
||||||
- '4433:4433' # public
|
- '4433:4433' # public
|
||||||
- '4434:4434' # admin
|
- '4434:4434' # admin
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ func Login(config *Config) error {
|
||||||
// unmarshal data to get id_token and access_token
|
// unmarshal data to get id_token and access_token
|
||||||
var data map[string]any
|
var data map[string]any
|
||||||
err = json.Unmarshal([]byte(tokenString), &data)
|
err = json.Unmarshal([]byte(tokenString), &data)
|
||||||
if err != nil {
|
if err != nil || data == nil {
|
||||||
return fmt.Errorf("failed to unmarshal token: %v", err)
|
return fmt.Errorf("failed to unmarshal token: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,6 +128,7 @@ func Login(config *Config) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to fetch identities: %v", err)
|
return fmt.Errorf("failed to fetch identities: %v", err)
|
||||||
}
|
}
|
||||||
|
fmt.Printf("Created new identity successfully.\n")
|
||||||
}
|
}
|
||||||
|
|
||||||
// extract the subject from ID token claims
|
// 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")
|
fmt.Printf("Fetching JWKS from authentication server for verification...\n")
|
||||||
err = idp.FetchJwk(config.ActionUrls.JwksUri)
|
err = idp.FetchJwk(config.ActionUrls.JwksUri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("failed to fetch JWK: %v\n", err)
|
return fmt.Errorf("failed to fetch JWK: %v\n", err)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("Attempting to add issuer to authorization server...\n")
|
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 {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to add trusted issuer: %v", err)
|
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
|
// use ID token/user info to fetch access token from authentication server
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue