Package vaultWeb.security.aspects
Class AdminOnlyAspect
java.lang.Object
vaultWeb.security.aspects.AdminOnlyAspect
Aspect that enforces admin-only access for methods annotated with
AdminOnly.
This aspect intercepts method calls and verifies that the currently authenticated user has an
ADMIN role in the specified group. If the user is not authenticated or does not have admin
privileges, an AdminAccessDeniedException is thrown.
Methods annotated with @AdminOnly must have the group ID as the first parameter (of
type Long) to allow the aspect to verify the user's role within that group.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckAdmin(org.aspectj.lang.JoinPoint joinPoint) Advice that runs before any method annotated withAdminOnly.
-
Constructor Details
-
AdminOnlyAspect
public AdminOnlyAspect()
-
-
Method Details
-
checkAdmin
public void checkAdmin(org.aspectj.lang.JoinPoint joinPoint) Advice that runs before any method annotated withAdminOnly.Checks if the current user is authenticated and has an ADMIN role in the specified group. Throws
AdminAccessDeniedExceptionif the user is not authenticated or not an admin.- Parameters:
joinPoint- the join point providing access to the method being invoked and its arguments- Throws:
AdminAccessDeniedException- if the user is not authenticated or does not have admin privilegesIllegalArgumentException- if the method does not have a group ID (Long) as its first argument
-