Skip to content

Commit 6bcf479

Browse files
committed
Polish Javadoc
Issue gh-9289
1 parent 6828987 commit 6bcf479

15 files changed

+66
-55
lines changed

core/src/main/java/org/springframework/security/authorization/method/AfterMethodAuthorizationManager.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
public interface AfterMethodAuthorizationManager<T> {
3939

4040
/**
41-
* Determines if access should be granted for a specific authentication and
41+
* Determine if access should be granted for a specific authentication, object and
4242
* returnedObject.
4343
* @param authentication the {@link Supplier} of the {@link Authentication} to check
4444
* @param object the {@code T} object to check, typically a {@link MethodInvocation}
@@ -53,7 +53,8 @@ default void verify(Supplier<Authentication> authentication, T object, Object re
5353
}
5454

5555
/**
56-
* Determines if access is granted for a specific authentication and returnedObject.
56+
* Determine if access is granted for a specific authentication, object, and
57+
* returnedObject.
5758
* @param authentication the {@link Supplier} of the {@link Authentication} to check
5859
* @param object the {@code T} object to check, typically a {@link MethodInvocation}
5960
* @param returnedObject the returned object from the method invocation to check

core/src/main/java/org/springframework/security/authorization/method/AuthorizationManagerMethodAfterAdvice.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,10 @@ public AuthorizationManagerMethodAfterAdvice(Pointcut pointcut,
5555
}
5656

5757
/**
58-
* Determines if an {@link Authentication} has access to the {@link T} object using
59-
* the {@link AuthorizationManager}.
58+
* Determine if an {@link Authentication} has access to the {@link T} object using the
59+
* {@link AuthorizationManager}.
6060
* @param authentication the {@link Supplier} of the {@link Authentication} to check
61-
* @param object the {@link T} object to check - note that {@code T} should contain
62-
* the returned object
61+
* @param object the {@link T} object to check
6362
* @throws AccessDeniedException if access is not granted
6463
*/
6564
@Override

core/src/main/java/org/springframework/security/authorization/method/AuthorizationManagerMethodBeforeAdvice.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public AuthorizationManagerMethodBeforeAdvice(Pointcut pointcut, AuthorizationMa
5454
}
5555

5656
/**
57-
* Determines if an {@link Authentication} has access to the {@link T} object using
58-
* the {@link AuthorizationManager}.
57+
* Determine if an {@link Authentication} has access to the {@link T} object using the
58+
* configured {@link AuthorizationManager}.
5959
* @param authentication the {@link Supplier} of the {@link Authentication} to check
6060
* @param object the {@link T} object to check
6161
* @throws AccessDeniedException if access is not granted

core/src/main/java/org/springframework/security/authorization/method/AuthorizationMethodAfterAdvice.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,15 @@ default Advice getAdvice() {
5555
}
5656

5757
/**
58-
* Determines if an {@link Authentication} has access to the returned object from the
59-
* {@link MethodInvocation}.
58+
* Determine if an {@link Authentication} has access to a method invocation's return
59+
* object.
6060
* @param authentication the {@link Supplier} of the {@link Authentication} to check
6161
* @param object the {@link T} object to check
62-
* @param returnedObject the returned object from the {@link MethodInvocation} to
63-
* check
64-
* @return the <code>Object</code> that will ultimately be returned to the caller (if
65-
* an implementation does not wish to modify the object to be returned to the caller,
66-
* the implementation should simply return the same object it was passed by the
67-
* <code>returnedObject</code> method argument)
62+
* @param returnedObject the returned object from the method invocation to check
63+
* @return the {@code Object} that will ultimately be returned to the caller (if an
64+
* implementation does not wish to modify the object to be returned to the caller, the
65+
* implementation should simply return the same object it was passed by the
66+
* {@code returnedObject} method argument)
6867
*/
6968
Object after(Supplier<Authentication> authentication, T object, Object returnedObject);
7069

core/src/main/java/org/springframework/security/authorization/method/AuthorizationMethodBeforeAdvice.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ default Advice getAdvice() {
5353
}
5454

5555
/**
56-
* Determines if an {@link Authentication} has access to the {@link T} object.
56+
* Determine if an {@link Authentication} has access to the {@link T} object.
5757
* @param authentication the {@link Supplier} of the {@link Authentication} to check
5858
* @param object the {@link T} object to check
5959
*/

core/src/main/java/org/springframework/security/authorization/method/AuthorizationMethodInterceptor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ public AuthorizationMethodInterceptor(AuthorizationMethodBeforeAdvice<MethodAuth
4949
}
5050

5151
/**
52-
* This method should be used to enforce security on a {@link MethodInvocation}.
52+
* Enforce security on this {@link MethodInvocation}.
5353
* @param mi the method being invoked which requires a security decision
54-
* @return the returned value from the {@link MethodInvocation}
54+
* @return the returned value from the {@link MethodInvocation}, possibly altered by
55+
* the configured {@link AuthorizationMethodAfterAdvice}
5556
*/
5657
@Override
5758
public Object invoke(@NonNull MethodInvocation mi) throws Throwable {

core/src/main/java/org/springframework/security/authorization/method/DelegatingAuthorizationMethodAfterAdvice.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,18 @@ public Pointcut getPointcut() {
7474
}
7575

7676
/**
77-
* Delegates to specific {@link AuthorizationMethodAfterAdvice}s and returns the
78-
* <code>returnedObject</code> (possibly modified) from the method argument.
77+
* Delegate to a series of {@link AuthorizationMethodAfterAdvice}s, each of which may
78+
* replace the {@code returnedObject} with its own
79+
*
80+
* Advices may be of type {@link AuthorizationManagerMethodAfterAdvice} in which case,
81+
* they will throw an
82+
* {@link org.springframework.security.access.AccessDeniedException} in the event that
83+
* they deny access to the {@code returnedObject}.
7984
* @param authentication the {@link Supplier} of the {@link Authentication} to check
8085
* @param object the {@link MethodAuthorizationContext} to check
81-
* @param returnedObject the returned object from the {@link MethodInvocation} to
82-
* check
83-
* @return the <code>returnedObject</code> (possibly modified) from the method
84-
* argument
86+
* @param returnedObject the returned object from the original method invocation
87+
* @throws org.springframework.security.access.AccessDeniedException if any delegate
88+
* advices deny access
8589
*/
8690
@Override
8791
public Object after(Supplier<Authentication> authentication, T object, Object returnedObject) {

core/src/main/java/org/springframework/security/authorization/method/DelegatingAuthorizationMethodBeforeAdvice.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,16 @@ public Pointcut getPointcut() {
7474
}
7575

7676
/**
77-
* Delegates to a specific {@link AuthorizationMethodBeforeAdvice} and grants access
78-
* if all {@link AuthorizationMethodBeforeAdvice}s granted or abstained. Denies only
79-
* if one of the {@link AuthorizationMethodBeforeAdvice}s denied.
77+
* Delegate to a series of {@link AuthorizationMethodBeforeAdvice}s
78+
*
79+
* Advices may be of type {@link AuthorizationManagerMethodBeforeAdvice} in which
80+
* case, they will throw an
81+
* {@link org.springframework.security.access.AccessDeniedException} in the event that
82+
* they deny access.
8083
* @param authentication the {@link Supplier} of the {@link Authentication} to check
8184
* @param object the {@link MethodAuthorizationContext} to check
85+
* @throws org.springframework.security.access.AccessDeniedException if any delegate
86+
* advices deny access
8287
*/
8388
@Override
8489
public void before(Supplier<Authentication> authentication, T object) {

core/src/main/java/org/springframework/security/authorization/method/Jsr250AuthorizationManager.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ public void setRolePrefix(String rolePrefix) {
7070
}
7171

7272
/**
73-
* Determines if an {@link Authentication} has access to the {@link MethodInvocation}
74-
* by evaluating if the {@link Authentication} contains a specified authority from the
75-
* JSR-250 security annotations.
73+
* Determine if an {@link Authentication} has access to a method by evaluating the
74+
* {@link DenyAll}, {@link PermitAll}, and {@link RolesAllowed} annotations that
75+
* {@link MethodAuthorizationContext} specifies.
7676
* @param authentication the {@link Supplier} of the {@link Authentication} to check
7777
* @param methodAuthorizationContext the {@link MethodAuthorizationContext} to check
7878
* @return an {@link AuthorizationDecision} or null if the JSR-250 security

core/src/main/java/org/springframework/security/authorization/method/MethodAuthorizationContext.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import org.aopalliance.intercept.MethodInvocation;
2020

2121
/**
22-
* An authorization context which is holds the {@link MethodInvocation}, the target class
23-
* and the returned object.
22+
* An authorization context which is holds the {@link MethodInvocation} and the target
23+
* class
2424
*
2525
* @author Evgeniy Cheban
2626
* @since 5.5
@@ -42,16 +42,16 @@ public MethodAuthorizationContext(MethodInvocation methodInvocation, Class<?> ta
4242
}
4343

4444
/**
45-
* Returns the {@link MethodInvocation}.
46-
* @return the {@link MethodInvocation} to use
45+
* Return the {@link MethodInvocation}.
46+
* @return the {@link MethodInvocation}
4747
*/
4848
public MethodInvocation getMethodInvocation() {
4949
return this.methodInvocation;
5050
}
5151

5252
/**
53-
* Returns the target class.
54-
* @return the target class to use
53+
* Return the target class.
54+
* @return the target class
5555
*/
5656
public Class<?> getTargetClass() {
5757
return this.targetClass;

0 commit comments

Comments
 (0)