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

Add support for authentication and authorization #554

Closed
wants to merge 10 commits into from

Conversation

woop
Copy link
Member

@woop woop commented Mar 20, 2020

What this PR does / why we need it:

First implementation of auth for Feast (related to #504 minimal implementation).

  1. Adds authentication to Feast Core (with support for different implementations). Currently only supports Google Open ID through gRPC metadata.
  2. Adds authorization to Feast Core (with support for different implementations). Currently only supports Ory Keto.
  3. Adds authentication to Python SDK/CLI. Users can enable authentication client side and Feast will send their Google Open ID credentials as gRPC metadata to Core.
  4. Refactor the Python SDK/CLI SSL/TLS handling.
  5. Prevents unauthorized creation or modification of feature sets in projects that a user does not have membership in.

Limitations

  • Does not handle user or role management in authorization provider (creating projects, adding members, removing members, listing members).

Which issue(s) this PR fixes:

Related to #504, but doesn't close the card. This is a minimal implementation.

Does this PR introduce a user-facing change?:

None

@feast-ci-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: woop

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

@woop woop added this to the v0.5.0 milestone Mar 20, 2020
@woop woop linked an issue Mar 20, 2020 that may be closed by this pull request
@woop woop added the area/core label Mar 20, 2020
@woop
Copy link
Member Author

woop commented Mar 23, 2020

/retest

1 similar comment
@woop
Copy link
Member Author

woop commented Mar 23, 2020

/retest

@woop
Copy link
Member Author

woop commented Mar 23, 2020

/test test-end-to-end

@woop woop mentioned this pull request Apr 29, 2020
@woop woop added the kind/feature New feature or request label Apr 30, 2020
@woop woop modified the milestones: v0.5.0, v0.6.0 May 2, 2020
@dr3s
Copy link
Collaborator

dr3s commented May 28, 2020

Does this really only support Google OpenID? It shouldn't be any effort to make the OIDC configurable to support any valid implementation such as Auth0.

* Google Open ID Authentication Provider. This provider is used to validate incoming requests to
* Feast Core.
*/
public class GoogleOpenIDAuthenticationProvider implements AuthenticationProvider {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like it would support any openid provider. Any reason the package and class can't be made generic?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, why even have this class at all? Why not just set up the JwtAuthenticationProvider directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

This seems like it would support any openid provider. Any reason the package and class can't be made generic?

It can.

Actually, why even have this class at all? Why not just set up the JwtAuthenticationProvider directly?

Honestly I don't recall why this was broken out. It looks like if we generalize cert handling then we can use JwtAuthenticationProvider


if (securityProperties.getAuthentication().isEnabled()) {
switch (securityProperties.getAuthentication().getProvider()) {
case "GoogleOpenID":
Copy link
Collaborator

Choose a reason for hiding this comment

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

not to beat a dead horse but this seems to provide little value over directly setting properties of the JwtAuthenticationProvider

switch (securityProperties.getAuthentication().getProvider()) {
case "GoogleOpenID":
providers.add(
new GoogleOpenIDAuthenticationProvider(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not use the capabilities of spring to configure the providers rather than build another factory method?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can be done. See points above.

if (securityProperties.getAuthentication().isEnabled()
&& securityProperties.getAuthorization().isEnabled()) {
switch (securityProperties.getAuthorization().getProvider()) {
case "KetoAuthorization":
Copy link
Collaborator

Choose a reason for hiding this comment

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

same as authentication provider factory comment.

Copy link
Member Author

Choose a reason for hiding this comment

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

How would you use Spring in this case?

Copy link
Collaborator

Choose a reason for hiding this comment

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

It's been awhile since I have done this in Spring Config but basically you dynamically create the @bean which then can accept normal spring config:

@Configuration
public class AuthConfiguration
{

     @Value("${feast.auth.authorizationProviderClass}")
     private String authorizationProviderClassName;

    @Bean
     public AuthorizationProvider authorizationProvider()
     {
        Class<?> authClass = Class.forName(authorizationProviderClassName);
        AuthorizationProvider authProvider = AuthorizationProvider.class.cast(authClass.newInstance());
        return authProvider;
     }

Copy link
Member Author

Choose a reason for hiding this comment

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

Yea that looks great, as long as failure is graceful and easy to debug.

@woop
Copy link
Member Author

woop commented May 29, 2020

Does this really only support Google OpenID? It shouldn't be any effort to make the OIDC configurable to support any valid implementation such as Auth0.

Yip, it should be pretty easy to extend to non-Google through config. This was a minimal implementation. The reason I specified it as Google is because our Python SDK uses OIDC tokens that it gets from a local Gcloud SDK and sends that along to Feast for auth. That is very Google specific.

Server side can easily be generalized.

@dr3s
Copy link
Collaborator

dr3s commented May 29, 2020

Does this really only support Google OpenID? It shouldn't be any effort to make the OIDC configurable to support any valid implementation such as Auth0.

Yip, it should be pretty easy to extend to non-Google through config. This was a minimal implementation. The reason I specified it as Google is because our Python SDK uses OIDC tokens that it gets from a local Gcloud SDK and sends that along to Feast for auth. That is very Google specific.

Server side can easily be generalized.

Got it. We have it on our list to add an generic oauth2/openid auth module to the client as well.

@dr3s
Copy link
Collaborator

dr3s commented Jun 16, 2020

replaced by #793

@dr3s dr3s closed this Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Authentication and authorization
3 participants