Skip to content

Commit bc54a7f

Browse files
Michael9127sssilver
authored andcommitted
AUTH-3537: AUDs in JWTs are now always arrays
1 parent 75c3ca2 commit bc54a7f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

token/token.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type signalHandler struct {
4646
signals []os.Signal
4747
}
4848

49-
type appJWTPayload struct {
49+
type jwtPayload struct {
5050
Aud []string `json:"aud"`
5151
Email string `json:"email"`
5252
Exp int `json:"exp"`
@@ -57,17 +57,12 @@ type appJWTPayload struct {
5757
Subt string `json:"sub"`
5858
}
5959

60-
type orgJWTPayload struct {
61-
appJWTPayload
62-
Aud string `json:"aud"`
63-
}
64-
6560
type transferServiceResponse struct {
6661
AppToken string `json:"app_token"`
6762
OrgToken string `json:"org_token"`
6863
}
6964

70-
func (p appJWTPayload) isExpired() bool {
65+
func (p jwtPayload) isExpired() bool {
7166
return int(time.Now().Unix()) > p.Exp
7267
}
7368

@@ -346,7 +341,7 @@ func GetOrgTokenIfExists(authDomain string) (string, error) {
346341
if err != nil {
347342
return "", err
348343
}
349-
var payload orgJWTPayload
344+
var payload jwtPayload
350345
err = json.Unmarshal(token.Payload, &payload)
351346
if err != nil {
352347
return "", err
@@ -368,7 +363,7 @@ func GetAppTokenIfExists(appInfo *AppInfo) (string, error) {
368363
if err != nil {
369364
return "", err
370365
}
371-
var payload appJWTPayload
366+
var payload jwtPayload
372367
err = json.Unmarshal(token.Payload, &payload)
373368
if err != nil {
374369
return "", err

0 commit comments

Comments
 (0)