Skip to content

Conversation

Tratcher
Copy link
Member

#122 This enables proxy routes to integrate with the existing ASP.NET Core authentication and authorization infrastructure.

This should unblock most users. I expect some feedback on the scenario for flowing user information to the destination server, we'll need to wait and see what people's scenarios are.

@Tratcher Tratcher added this to the 1.0.0-preview3 milestone Jun 25, 2020
@Tratcher Tratcher self-assigned this Jun 25, 2020
{
endpointBuilder.Metadata.Add(AnonymousAuthorization);
}
else if (!string.IsNullOrEmpty(source.Authorization))
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to add multiple Policy to a route?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, what would that mean?

This is the same as adding an Authorize attribute on a controller.

{
endpointBuilder.Metadata.Add(AnonymousAuthorization);
}
else if (!string.IsNullOrEmpty(source.Authorization))
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to set Authentication Scheme for AuthorizeAttribute?

Copy link
Member Author

Choose a reason for hiding this comment

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

The auth schemes can be set on the policy, is that enough?

@Tratcher Tratcher requested a review from HaoK June 25, 2020 12:22
Copy link
Contributor

@alnikola alnikola left a comment

Choose a reason for hiding this comment

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

A few comments.

{
internal static class AuthorizationContants
{
internal const string Default = "Default";
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it's better to set public visibility on type's member if the type itself is scoped internal.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why? You get the same behavior either way.

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;

namespace Microsoft.ReverseProxy.Auth.Sample
Copy link
Member

Choose a reason for hiding this comment

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

Why is this sample doing auth with MVC?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I needed something visual and self-contained.

Or do you mean I should use razor pages instead?

@Tratcher Tratcher requested a review from HaoK June 26, 2020 17:04
hash ^= ClusterId.GetHashCode();
}

if (!string.IsNullOrEmpty(AuthorizationPolicy))
Copy link
Member

Choose a reason for hiding this comment

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

I just looked at this hash function and realized how crazy expensive this is. How often is it used? Not very I hope.

Copy link
Member Author

Choose a reason for hiding this comment

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

Once per config reload.

@Tratcher Tratcher merged commit ea33e9c into master Jun 26, 2020
@Tratcher Tratcher deleted the tratcher/authz branch June 26, 2020 18:59
@Tratcher Tratcher linked an issue Jun 26, 2020 that may be closed by this pull request
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.

Proxy supports authentication / authorization for specific routes

5 participants