Skip to content

Commit 13d83a6

Browse files
authored
User session fixes (#3397)
1 parent 6075387 commit 13d83a6

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

api/user_session.go

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,7 @@ func registerSessionHandlers(api *operations.ConsoleAPI) {
5555
}
5656

5757
func getClaimsFromToken(sessionToken string) (map[string]interface{}, error) {
58-
jp := new(jwtgo.Parser)
59-
// nolint:staticcheck // ignore SA1019
60-
jp.ValidMethods = []string{
61-
"RS256", "RS384", "RS512", "ES256", "ES384", "ES512",
62-
"RS3256", "RS3384", "RS3512", "ES3256", "ES3384", "ES3512",
63-
}
58+
jp := jwtgo.NewParser()
6459
var claims jwtgo.MapClaims
6560
_, _, err := jp.ParseUnverified(sessionToken, &claims)
6661
if err != nil {
@@ -115,7 +110,7 @@ func getSessionResponse(ctx context.Context, session *models.Principal) (*models
115110

116111
// All calls from console are signature v4.
117112
condition.S3SignatureVersion.Name(): {"AWS4-HMAC-SHA256"},
118-
// All calls from console are signature v4.
113+
// All calls from console use header-based authentication
119114
condition.S3AuthType.Name(): {"REST-HEADER"},
120115
// This is usually empty, may be set some times (rare).
121116
condition.S3LocationConstraint.Name(): {GetMinIORegion()},
@@ -237,15 +232,6 @@ func getSessionResponse(ctx context.Context, session *models.Principal) (*models
237232
resourcePermissions[key] = resourceActions
238233

239234
}
240-
serializedPolicy, err := json.Marshal(policy)
241-
if err != nil {
242-
return nil, ErrorWithContext(ctx, err, ErrInvalidSession)
243-
}
244-
var sessionPolicy *models.IamPolicy
245-
err = json.Unmarshal(serializedPolicy, &sessionPolicy)
246-
if err != nil {
247-
return nil, ErrorWithContext(ctx, err)
248-
}
249235

250236
// environment constants
251237
var envConstants models.EnvironmentConstants

0 commit comments

Comments
 (0)