mirror of
https://github.com/davidallendj/opaal.git
synced 2025-12-19 19:17:01 -07:00
Fixed imports from project name change
This commit is contained in:
parent
02cbc2f2eb
commit
6c0f1303ac
3 changed files with 9 additions and 7 deletions
|
|
@ -1,9 +1,9 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"davidallendj/opal/internal/oauth"
|
||||
"davidallendj/opal/internal/oidc"
|
||||
"davidallendj/opal/internal/util"
|
||||
"davidallendj/opaal/internal/oauth"
|
||||
"davidallendj/opaal/internal/oidc"
|
||||
"davidallendj/opaal/internal/util"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
|
|
|||
|
|
@ -107,11 +107,11 @@ var loginCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
// fetch JWKS and add issuer to authentication server to submit ID token
|
||||
jwk, err := api.FetchJwk("")
|
||||
err = idp.FetchJwk("")
|
||||
if err != nil {
|
||||
fmt.Printf("failed to fetch JWK: %v\n", err)
|
||||
} else {
|
||||
api.AddTrustedIssuer(config.AuthEndpoints.TrustedIssuers, jwk.(string))
|
||||
api.AddTrustedIssuer(config.AuthEndpoints.TrustedIssuers, idp.Key)
|
||||
}
|
||||
|
||||
// use ID token/user info to fetch access token from authentication server
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import (
|
|||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/lestrrat-go/jwx/jwk"
|
||||
)
|
||||
|
||||
func WaitForAuthorizationCode(serverAddr string, loginUrl string) (string, error) {
|
||||
|
|
@ -78,7 +80,7 @@ func FetchAccessToken(remoteUrl string, clientId string, jwt string, scopes []st
|
|||
return token, nil
|
||||
}
|
||||
|
||||
func AddTrustedIssuer(remoteUrl string, issuer string, subject string, duration time.Duration, jwk string, scope []string) error {
|
||||
func AddTrustedIssuer(remoteUrl string, issuer string, subject string, duration time.Duration, jwk jwk.Key, scope []string) error {
|
||||
// hydra endpoint: /admin/trust/grants/jwt-bearer/issuers
|
||||
data := []byte(fmt.Sprintf(`{
|
||||
"allow_any_subject": false,
|
||||
|
|
@ -87,7 +89,7 @@ func AddTrustedIssuer(remoteUrl string, issuer string, subject string, duration
|
|||
"expires_at": "%v"
|
||||
"jwk": %v,
|
||||
"scope": [ j%s ],
|
||||
}`, issuer, subject, time.Now().Add(duration), jwk, strings.Join(scope, ",")))
|
||||
}`, issuer, subject, time.Now().Add(duration), string(jwk), strings.Join(scope, ",")))
|
||||
|
||||
req, err := http.NewRequest("POST", remoteUrl, bytes.NewBuffer(data))
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue