Skip to content

Commit

Permalink
merge: changes from master
Browse files Browse the repository at this point in the history
  • Loading branch information
kha7iq committed Mar 17, 2024
2 parents ce34f8a + eb11748 commit 8bfb13b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion internal/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (provider *OIDCProviderInfo) VerifyToken(aToken string) error {
ctx := context.Background()
_, err := provider.KeySet.VerifySignature(ctx, aToken)
if err != nil {
return fmt.Errorf("Access token verification failed:", err)
return fmt.Errorf("Access token verification failed: %v", err)
}

// Set up the JWT token parser
Expand Down
8 changes: 4 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ func main() {
// Get provider configuration
provider, err := auth.GetProviderInfo(providerEndpoint)
if err != nil {
log.Fatalf("Failed to retrieve provider configuration: %v\n", err)
log.Fatalf("Failed to retrieve provider configuration for provider %v with error %v\n", providerEndpoint, err)
}

// Retrieve an OIDC token using the password grant type
accessToken, err := auth.RequestJWT(username, password, otp, provider.TokenURL, c.ClientID, c.ClientSecret, c.ClientScope)
if err != nil {
log.Fatalf("Failed to retrieve token: %v\n", err)
log.Fatalf("Failed to retrieve token for %v - error: %v\n", username, err)
os.Exit(2)
}

// Verify the token and retrieve the ID token
if err := provider.VerifyToken(accessToken); err != nil {
// handle the error
log.Fatal(err)
log.Fatalf("Failed to verify token %v for user %v\n", err, username)
os.Exit(3)
}
log.Println("Token acquired and verified Successfully.")
log.Println("Token acquired and verified Successfully for user -", username)
}

0 comments on commit 8bfb13b

Please sign in to comment.