mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 19:29:57 +00:00
Revert "CC-796: Remove dependency on unsupported version of go-oidc"
This reverts commit 0899d6a136
.
This commit is contained in:
@@ -13,9 +13,9 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/coreos/go-oidc/jose"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rs/zerolog"
|
||||
"gopkg.in/square/go-jose.v2"
|
||||
|
||||
"github.com/cloudflare/cloudflared/config"
|
||||
"github.com/cloudflare/cloudflared/retry"
|
||||
@@ -342,7 +342,7 @@ func GetOrgTokenIfExists(authDomain string) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
var payload jwtPayload
|
||||
err = json.Unmarshal(token.UnsafePayloadWithoutVerification(), &payload)
|
||||
err = json.Unmarshal(token.Payload, &payload)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -351,7 +351,7 @@ func GetOrgTokenIfExists(authDomain string) (string, error) {
|
||||
err := os.Remove(path)
|
||||
return "", err
|
||||
}
|
||||
return token.CompactSerialize()
|
||||
return token.Encode(), nil
|
||||
}
|
||||
|
||||
func GetAppTokenIfExists(appInfo *AppInfo) (string, error) {
|
||||
@@ -364,7 +364,7 @@ func GetAppTokenIfExists(appInfo *AppInfo) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
var payload jwtPayload
|
||||
err = json.Unmarshal(token.UnsafePayloadWithoutVerification(), &payload)
|
||||
err = json.Unmarshal(token.Payload, &payload)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -373,21 +373,22 @@ func GetAppTokenIfExists(appInfo *AppInfo) (string, error) {
|
||||
err := os.Remove(path)
|
||||
return "", err
|
||||
}
|
||||
return token.CompactSerialize()
|
||||
return token.Encode(), nil
|
||||
|
||||
}
|
||||
|
||||
// GetTokenIfExists will return the token from local storage if it exists and not expired
|
||||
func getTokenIfExists(path string) (*jose.JSONWebSignature, error) {
|
||||
func getTokenIfExists(path string) (*jose.JWT, error) {
|
||||
content, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
token, err := jose.ParseSigned(string(content))
|
||||
token, err := jose.ParseJWT(string(content))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return token, nil
|
||||
|
||||
return &token, nil
|
||||
}
|
||||
|
||||
// RemoveTokenIfExists removes the a token from local storage if it exists
|
||||
|
Reference in New Issue
Block a user