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

Added RS256 alg support via Okta lib #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thomasyip
Copy link

- Summary
This PR adds support for OAuth2 RS256 alg via Okta's golang lib. There were a few typical pitfalls on implementing OAuth, we feel it was better to use the lib developed by our vendor. (eg, dgrijalva/jwt-go#147)

The PR abstracts auth.go to make the new implementation work alongside with the existing alg. It also makes adding other alg or implementing it with other lib easier later.

We can back-out the Okta implementation upon request. But, we like the abstraction on auth.go to stay such to make it easier for us to keep it in-sync.

- Test plan
The Docker on master branch failed to build when we pulled** and had no instruction on how to get it runs. We got it to built and provided some instructions.

** (I later found out there is travis setup. I didn't aware of Travis-ci setup in the beginning.)

We didn't add test in this PR, but believe we improves the quality a little bit over existing condition for the Docker use-case.

The PR should pass Travis-CI. I added an workaround to make Travis-ci works for a fork.

- Description for the changelog
Added the option to authenticate using OKTA lib (which use RS256 alg).
* Updated golang to 1.11 (the original docker was on 1.8 and code didn't build on it)
* Added instructions to run git-gateway to README.md
* Added abstraction to auth.go such that different implementations of auth can be used
* Updated example.env
* Updated travis

- A picture of a cute animal (not mandatory but encouraged)
common health problems for ragamuffin cats _ ragamuffin cat with green eyes looking up

* Updated golang to 1.11 (the original docker was on 1.8 and code didn't build on it)
* Added instructions to run git-gateway to README.md
* Added abstraction to auth.go such that different implementations of auth can be used
* Updated example.env
* updated to golang 1.11
* worked around open-source fork problem
* fixed lint on auth.go and errors.go
@thomasyip thomasyip changed the title Branch okta support Added RS256 alg support via Okta lib Nov 29, 2018
@thomasyip
Copy link
Author

@calavera @Benaiah or @rybit is this PR something you guys might consider adopting? I have some time today and tomorrow to address comment. After tomorrow, it will be harder for me to spend time on it. Thank you very much for your time.

Copy link
Contributor

@calavera calavera left a comment

Choose a reason for hiding this comment

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

Thanks for the improvement @thomasyip ! I'm concerned about keeping backwards compatibility. I left you a comment that should be easy to address.

} else if (authenticatorName == "bearer-okta-jwt-token") {
auth.authenticator = &OktaJWTAuthenticator{name: "bearer-okta-jwt-token", auth: *auth}
} else {
if (authenticatorName != "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to keep backwards compatibility, this initialization should not fail. The default behavior when there is no authenticationName should be to use bearer jwt tokens.

Copy link
Author

Choose a reason for hiding this comment

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

@calavera good catch. I didn't mean to break backward compatibility.

I will address the request soon. Hopefully within this week.

Thank for your time and looking over the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants