1
0
mirror of https://github.com/smallstep/cli.git synced 2025-08-09 03:22:43 +03:00

Rename function

This commit is contained in:
Mariano Cano
2022-02-01 14:17:37 -08:00
parent 3fe25da566
commit 2c2a8b5e79
3 changed files with 4 additions and 4 deletions

View File

@@ -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.

View File

@@ -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
}

View File

@@ -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