Skip to content
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

Merged
merged 1 commit into from
Dec 23, 2020

Conversation

sm43
Copy link
Member

@sm43 sm43 commented Oct 27, 2020

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.

@tekton-robot tekton-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Oct 27, 2020
@sm43
Copy link
Member Author

sm43 commented Oct 27, 2020

/hold
till preview UI is updated

@sm43 sm43 added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 27, 2020
@sm43 sm43 force-pushed the jwt-expiry branch 2 times, most recently from 3b3f5ec to 0bfc23d Compare October 28, 2020 17:38
// See the License for the specific language governing permissions and
// limitations under the License.

package migration
Copy link
Member

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 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this

@sm43 sm43 force-pushed the jwt-expiry branch 10 times, most recently from e79fdf4 to 9efbe8b Compare November 2, 2020 11:59
@sm43 sm43 removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 2, 2020
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JWT configuration

@piyush-garg
Copy link
Contributor

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 9, 2020
@@ -60,15 +61,22 @@ type APIBase struct {
type Config interface {
BaseConfig
OAuthConfig() *oauth2.Config
JWTSigningKey() string
JWT() *JWT
Copy link
Member

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 ?

@@ -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 {
Copy link
Member

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) {
Copy link
Member

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 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// environment variables
func jwtSigningKey() (string, error) {
func jwtConfig() (*JWT, error) {
Copy link
Member

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 ?

return 0, fmt.Errorf("invalid duration value %s : %v. Valid format: '1d', '3h' or '15m'", dur, err)
}

switch format {
Copy link
Member

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 ?

@tekton-robot tekton-robot removed the lgtm Indicates that a PR is ready to be merged. label Nov 9, 2020
@sm43
Copy link
Member Author

sm43 commented Nov 11, 2020

/hold
as discussed we will merge this with UI's PR for auth flow.

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 11, 2020
@tekton-robot tekton-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 18, 2020
@sm43 sm43 changed the title Adds expiry time in User access JWT and auth also returns Refresh JWT Updates Auth API to return Access and Refresh Token Nov 18, 2020
@sm43 sm43 removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2020
@tekton-robot tekton-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 23, 2020
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>
@tekton-robot tekton-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 10, 2020
@sm43
Copy link
Member Author

sm43 commented Dec 14, 2020

/retest

@PuneetPunamiya
Copy link
Member

/lgtm

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 22, 2020
@piyush-garg
Copy link
Contributor

/lgtm

@PuneetPunamiya
Copy link
Member

/approve
/meow

@tekton-robot
Copy link

@PuneetPunamiya: cat image

In response to this:

/approve
/meow

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.

@tekton-robot
Copy link

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 23, 2020
@tekton-robot tekton-robot merged commit eae5fc9 into tektoncd:master Dec 23, 2020
@sm43 sm43 deleted the jwt-expiry branch January 4, 2021 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants