mirror of
https://github.com/davidallendj/opaal.git
synced 2026-02-04 00:36:26 -07:00
Compare commits
3 commits
main
...
v0.3.10-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5541744096 | ||
|
|
8570064235 | ||
|
|
2612978a98 |
2 changed files with 10 additions and 5 deletions
|
|
@ -51,6 +51,9 @@ func NewJwtBearerFlow(eps JwtBearerFlowEndpoints, params JwtBearerFlowParams) (s
|
||||||
if client == nil {
|
if client == nil {
|
||||||
return "", fmt.Errorf("invalid client (client is nil)")
|
return "", fmt.Errorf("invalid client (client is nil)")
|
||||||
}
|
}
|
||||||
|
if verbose {
|
||||||
|
fmt.Printf("ID token (IDP): %s\n access token (IDP): %s", accessToken, idToken)
|
||||||
|
}
|
||||||
if accessToken != "" {
|
if accessToken != "" {
|
||||||
_, err := jws.Verify([]byte(accessToken), jws.WithKeySet(client.Provider.KeySet), jws.WithValidateKey(true))
|
_, err := jws.Verify([]byte(accessToken), jws.WithKeySet(client.Provider.KeySet), jws.WithValidateKey(true))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,14 @@ func (client *Client) FetchTokenFromAuthenticationServer(code string, state stri
|
||||||
}
|
}
|
||||||
res, err := http.PostForm(client.Provider.Endpoints.Token, body)
|
res, err := http.PostForm(client.Provider.Endpoints.Token, body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get ID token: %s", err)
|
return nil, fmt.Errorf("failed to get ID token: %v", err)
|
||||||
}
|
}
|
||||||
|
b, err := io.ReadAll(res.Body)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("failed to read response body: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Printf("%s\n", string(b))
|
||||||
defer res.Body.Close()
|
defer res.Body.Close()
|
||||||
|
|
||||||
// domain, _ := url.Parse("http://127.0.0.1")
|
return b, nil
|
||||||
// client.Jar.SetCookies(domain, res.Cookies())
|
|
||||||
|
|
||||||
return io.ReadAll(res.Body)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue