Skip to content

Add Json Web Token (JWT) authenticator#10289

Merged
dain merged 3 commits intoprestodb:masterfrom
dain:jwt-token-authentication
Apr 6, 2018
Merged

Add Json Web Token (JWT) authenticator#10289
dain merged 3 commits intoprestodb:masterfrom
dain:jwt-token-authentication

Conversation

@dain
Copy link
Contributor

@dain dain commented Mar 29, 2018

No description provided.

@dain dain force-pushed the jwt-token-authentication branch 2 times, most recently from f9a73a9 to 4dc6515 Compare March 29, 2018 16:59
@dain dain changed the title Add Json Web Token (JWT) authenticator [WIP] Add Json Web Token (JWT) authenticator Mar 29, 2018
@dain dain force-pushed the jwt-token-authentication branch 2 times, most recently from e97bc79 to ace92da Compare April 3, 2018 05:42
@dain dain changed the title [WIP] Add Json Web Token (JWT) authenticator Add Json Web Token (JWT) authenticator Apr 3, 2018
@dain dain force-pushed the jwt-token-authentication branch from ace92da to bc75964 Compare April 4, 2018 02:09
@dain dain force-pushed the jwt-token-authentication branch from bc75964 to a1f475a Compare April 4, 2018 19:51
Copy link
Contributor

@electrum electrum left a comment

Choose a reason for hiding this comment

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

Typo "autentication" in the commit message

Copy link
Contributor

Choose a reason for hiding this comment

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

This has an extra '

Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to catch JwtException (and maybe others) and call needAuthentication() with the message. A RuntimeException thrown from authenticate() will cause the server to return a 500, so that should only happen if there is an internal error, not due to an expired token or similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those errors should only happen if the token is not trusted or corrupted. In other authenticators, they throw runtime when this happens. I think we should have another mechanism to communicate these kinds of errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is null allowed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you don't set is, all issuers are allowed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is null allowed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same

Copy link
Contributor

Choose a reason for hiding this comment

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

Static import the assertion methods

Copy link
Contributor

Choose a reason for hiding this comment

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

Use the constant AUTHORIZATION like the method above

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we do validation to make sure the token is only printable ASCII? I'm wondering what happens if you put in a newline, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What happens for username and password?

Copy link
Contributor

Choose a reason for hiding this comment

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

The password is base64 encoded. I suppose we should have validation for username and other headers.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed? We do a force refresh in TestingPrestoServer. I don't know why this is in TestPrestoDriver

Copy link
Contributor

Choose a reason for hiding this comment

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

If we do need this, import the one from TestPrestoDriver

Copy link
Contributor

Choose a reason for hiding this comment

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

Import the method from TestPrestoDriver

@electrum
Copy link
Contributor

electrum commented Apr 5, 2018 via email

Copy link
Contributor

Choose a reason for hiding this comment

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

Add this to the JDBC docs

@dain dain force-pushed the jwt-token-authentication branch from a1f475a to a9e3191 Compare April 6, 2018 01:11
pom.xml Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be better to add an exception for maven-dependency-versions-check-plugin below, as these are actually required but the version is wrong

Copy link
Contributor

Choose a reason for hiding this comment

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

Put before SSL

@dain dain force-pushed the jwt-token-authentication branch 2 times, most recently from 137c35d to 891c425 Compare April 6, 2018 01:32
@dain dain force-pushed the jwt-token-authentication branch from 891c425 to c6d3d6c Compare April 6, 2018 01:51
@dain dain closed this Apr 6, 2018
@dain dain deleted the jwt-token-authentication branch April 6, 2018 03:18
@dain dain merged commit c6d3d6c into prestodb:master Apr 6, 2018
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.

3 participants