-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature/compartment #413
feature/compartment #413
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that the key is a string. Consumers can write their own getters. Let's get rid of the multivarient thing that account_id uses. The context key is var string = "compartment_id"
no reason to support any other key.
auth/jwt.go
Outdated
multiCompartmentVariants = []string{ | ||
MultiCompartmentField, | ||
"CompartmentID", | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multiCompartmentVariants = []string{ | |
MultiCompartmentField, | |
"CompartmentID", | |
} |
Let's not do this. You have defined the field name as compartment_id
, there's no reason for it to then attempt to read CompartmentID
. I have no idea why AccountID supports two variations, probably backwards compatibility to dead code
auth/jwt.go
Outdated
for _, compartmentField := range multiCompartmentVariants { | ||
val, err = GetJWTField(ctx, compartmentField, keyfunc) | ||
if err == nil { | ||
return val, nil | ||
} | ||
} | ||
if err == errMissingField { | ||
return val, nil | ||
} | ||
return val, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for _, compartmentField := range multiCompartmentVariants { | |
val, err = GetJWTField(ctx, compartmentField, keyfunc) | |
if err == nil { | |
return val, nil | |
} | |
} | |
if err == errMissingField { | |
return val, nil | |
} | |
return val, err | |
return GetJWTField(ctx, compartmentField, keyfunc) |
auth/jwt.go
Outdated
var val string | ||
var err error | ||
val, err = GetJWTField(ctx, MultiCompartmentField, keyfunc) | ||
if err == nil || err == errMissingField { | ||
return val, nil | ||
} else { | ||
return val, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does the same thing. Guess I'm fine with ignoring missing compartment errors.
var val string | |
var err error | |
val, err = GetJWTField(ctx, MultiCompartmentField, keyfunc) | |
if err == nil || err == errMissingField { | |
return val, nil | |
} else { | |
return val, err | |
} | |
val, err := GetJWTField(ctx, MultiCompartmentField, keyfunc) | |
if err == errMissingField { | |
return "", nil | |
} | |
return val, err |
No description provided.