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

AuthorizationEvaluator should check authentication state #56

Closed
Vouzamo opened this issue Jul 12, 2019 · 7 comments
Closed

AuthorizationEvaluator should check authentication state #56

Vouzamo opened this issue Jul 12, 2019 · 7 comments
Labels
question Further information is requested

Comments

@Vouzamo
Copy link

Vouzamo commented Jul 12, 2019

The first thing in the default AuthorizationEvaluator .Evaluate method should be a check of principal.Identity.IsAuthenticated to conditionally return an AuthenticationResult.Fail() if false since claims are only valid for an authenticated user.

@Vouzamo
Copy link
Author

Vouzamo commented Jul 12, 2019

Also seems odd that AuthorizeWith() and RequireAuthorization() extensions methods don't do any authorization checks by calling the internal Authorization evaluator and only check for claim matches.

@joemcbride
Copy link
Member

The “next” branch adds an Authorization requirement that you can use to check for an authenticated user. You can add that requirement today in your own codebase if you wish.

5795fb5

@Vouzamo
Copy link
Author

Vouzamo commented Jul 12, 2019

Ahhhh...

.RequireAuthorization() is not to mark a type as requiring authorization. It is a convenience method for checking if any policies have been defined against the type using the .AuthorizeWith() method.

As such there is no method currently for flagging a type needs to be authorized but not against specific policies, correct?

I guess the requirement you suggest would still need to be registered against a policy and that policy used e.g. .AuthorizeWith("authenticated");

@joemcbride
Copy link
Member

Yes. A policy could be anything, not only related to the authenticated user. Such as, maybe your policy checks a configuration value or something like that.

@OpenSpacesAndPlaces
Copy link

See #49 (comment)
for an example flow.

Once you get used to the setup, it's actually pretty straight forward.

@sungam3r
Copy link
Member

@Vouzamo Is this issue still actual?

@sungam3r
Copy link
Member

Closed due to inactivity.

@sungam3r sungam3r added the question Further information is requested label May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants