MethodSecurityService add additional methods
Fixes: gh-5016
This commit is contained in:
parent
ca5fb78ee1
commit
6c52eb6ee1
|
@ -17,10 +17,10 @@
|
|||
package org.springframework.security.config.annotation.method.configuration;
|
||||
|
||||
import org.springframework.security.access.annotation.Secured;
|
||||
import org.springframework.security.access.method.P;
|
||||
import org.springframework.security.access.prepost.PostAuthorize;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import javax.annotation.security.DenyAll;
|
||||
import javax.annotation.security.PermitAll;
|
||||
|
@ -50,6 +50,12 @@ public interface MethodSecurityService {
|
|||
@PreAuthorize("permitAll")
|
||||
String preAuthorizePermitAll();
|
||||
|
||||
@PreAuthorize("!anonymous")
|
||||
void preAuthorizeNotAnonymous();
|
||||
|
||||
@PreAuthorize("@authz.check(#result)")
|
||||
void preAuthorizeBean(@P("result") boolean result);
|
||||
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
void preAuthorizeAdmin();
|
||||
|
||||
|
|
|
@ -53,6 +53,14 @@ public class MethodSecurityServiceImpl implements MethodSecurityService {
|
|||
return SecurityContextHolder.getContext().getAuthentication();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preAuthorizeNotAnonymous() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preAuthorizeBean(boolean b) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preAuthorizeAdmin() {
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue