-
Notifications
You must be signed in to change notification settings - Fork 6k
Add AuthorizationManager #8900
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
Comments
@rwinch I would like to work on this. |
It's yours, @evgeniycheban |
@jzheaux I created a very draft PR. Please take a look when you have a moment. Am I moving in the right direction? |
Thanks for the review @jzheaux @rwinch @jzheaux I have a few questions.
I've currently added support for |
Good questions, @evgeniycheban.
One of the goals of this ticket is to deprecate Ideally, then, Since the public API allows an application to configure an One of the tricky parts here seems to be how to deal with the
Yes, I think that makes sense, though I think it should be internal to that class. |
@jzheaux I've implemented an adapter, but we need to check that an AuthorizationManagerAdapterpublic class AuthorizationManagerAdapter<T> implements AuthorizationManager<T> {
private final AccessDecisionManager accessDecisionManager;
private final SecurityMetadataSource metadataSource;
public AuthorizationManagerAdapter(AccessDecisionManager accessDecisionManager,
SecurityMetadataSource metadataSource) {
this.accessDecisionManager = accessDecisionManager;
this.metadataSource = metadataSource;
}
@Override
public AuthorizationDecision check(Supplier<Authentication> authentication, T object) {
Collection<ConfigAttribute> attributes = this.metadataSource.getAttributes(object);
try {
this.accessDecisionManager.decide(authentication.get(), object, attributes);
}
catch (AccessDeniedException e) {
return new AuthorizationDecision(false);
}
return new AuthorizationDecision(true);
}
} |
I added it at the gateway ,However, you can only enter the check method when adding the authentication header,If it is not added, the null pointer exception will be reported if it is forwarded to the corresponding service through the gateway. What's the matter |
We should add an
AuthorizationManager
which is an imperative version ofReactiveAuthorizationManager
. The class should look something like:Using something that allows delaying looking up the
Authentication
likeSupplier<Authentication>
vs anAuthentication
directly.We should also add support for
AuthorizationManager
inHttpSecurity.authorizeRequests()
.Finally, we should change around the existing classes that use
AccessDecisionManager
should migrate toAuthorizationManager
andAccessDecisionManager
should be marked as deprecated.The text was updated successfully, but these errors were encountered: