-
Notifications
You must be signed in to change notification settings - Fork 104
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
Updates Auth API to return Access and Refresh Token #128
Conversation
/hold |
3b3f5ec
to
0bfc23d
Compare
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package migration |
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.
Just a question do we need to add a test for this ?
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.
not sure about this
e79fdf4
to
9efbe8b
Compare
api/pkg/app/app.go
Outdated
@@ -60,15 +61,22 @@ type APIBase struct { | |||
type Config interface { | |||
BaseConfig | |||
OAuthConfig() *oauth2.Config | |||
JWTSigningKey() string | |||
JWT() *JWT | |||
} | |||
|
|||
// APIConfig defines struct on top of APIBase with GitHub Oauth | |||
// Configuration & JWT Signing Key |
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.
JWT configuration
/lgtm |
api/pkg/app/app.go
Outdated
@@ -60,15 +61,22 @@ type APIBase struct { | |||
type Config interface { | |||
BaseConfig | |||
OAuthConfig() *oauth2.Config | |||
JWTSigningKey() string | |||
JWT() *JWT |
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.
could you please name this JWTConfig
? it isn't a jwt
, is it ?
api/pkg/app/app.go
Outdated
@@ -228,7 +236,7 @@ func FromEnvFile(file string) (*APIConfig, error) { | |||
if ac.conf, err = initOAuthConfig(); err != nil { | |||
return nil, err | |||
} | |||
if ac.jwtKey, err = jwtSigningKey(); err != nil { | |||
if ac.jwt, err = jwtConfig(); err != nil { |
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.
ac.jwtConfig please :)
return conf, nil | ||
} | ||
|
||
func computeDuration(dur string) (time.Duration, error) { |
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.
could you please consider writing a unit test for this ?
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.
is this different from https://golang.org/pkg/time/#ParseDuration ?
api/pkg/app/app.go
Outdated
// environment variables | ||
func jwtSigningKey() (string, error) { | ||
func jwtConfig() (*JWT, error) { |
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.
could you please consider writing a unit test ?
api/pkg/app/app.go
Outdated
return 0, fmt.Errorf("invalid duration value %s : %v. Valid format: '1d', '3h' or '15m'", dur, err) | ||
} | ||
|
||
switch format { |
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 wouldn't allow 1d12h45m10s would it ?
/hold |
This adds expiry time in user jwt and auth returns refresh jwt along with access jwt. The refresh jwt can be later used to get a new access jwt. Signed-off-by: Shivam Mukhade <smukhade@redhat.com>
/retest |
/lgtm |
/lgtm |
/approve |
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: PuneetPunamiya The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
This adds expiry time in user jwt and auth returns refresh jwt
along with access jwt. The refresh jwt can be later used to get a
new access jwt.
Signed-off-by: Shivam Mukhade smukhade@redhat.com
Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.