You've already forked step-ca-cli
mirror of
https://github.com/smallstep/cli.git
synced 2025-08-09 03:22:43 +03:00
Rename function
This commit is contained in:
@@ -203,7 +203,7 @@ func loginAction(ctx *cli.Context) error {
|
||||
// NOTE: For OIDC tokens the subject should always be the email. The
|
||||
// provisioner is responsible for loading and setting the principals with
|
||||
// the application of an Identity function.
|
||||
if email, ok := tokenHasEmail(token); ok {
|
||||
if email, ok := tokenEmail(token); ok {
|
||||
subject = email
|
||||
} else if subject == "" {
|
||||
// For non-oidc tokens we will use the token subject.
|
||||
|
@@ -148,7 +148,7 @@ func doLoginIfNeeded(ctx *cli.Context, subject string) error {
|
||||
// NOTE: For OIDC tokens the subject should always be the email. The
|
||||
// provisioner is responsible for loading and setting the principals with
|
||||
// the application of an Identity function.
|
||||
if email, ok := tokenHasEmail(token); ok {
|
||||
if email, ok := tokenEmail(token); ok {
|
||||
subject = email
|
||||
}
|
||||
|
||||
|
@@ -240,9 +240,9 @@ func loginOnUnauthorized(ctx *cli.Context) (ca.RetryFunc, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
// tokenHasEmail returns if the token payload has an email address. This is
|
||||
// tokenEmail returns if the token payload has an email address. This is
|
||||
// mainly used on OIDC token.
|
||||
func tokenHasEmail(s string) (string, bool) {
|
||||
func tokenEmail(s string) (string, bool) {
|
||||
jwt, err := token.ParseInsecure(s)
|
||||
if err != nil {
|
||||
return "", false
|
||||
|
Reference in New Issue
Block a user