use of org.sklsft.commons.rest.security.access.AccessControlType in project skeleton-commons by skeleton-software-community.
the class AccessControlAspect method handleHandshake.
@Around("@annotation(org.springframework.web.bind.annotation.RequestMapping)")
public Object handleHandshake(ProceedingJoinPoint joinPoint) throws Throwable {
try {
AccessControlType accessControlType = getAccessControlType(joinPoint);
TokenExtractionMode tokenExtractionMode = getTokenExtractionMode(joinPoint);
accessController.handshake(accessControlType, tokenExtractionMode);
return joinPoint.proceed();
} catch (Throwable t) {
logger.error(t.getMessage(), t);
throw t;
} finally {
securityContextProvider.clearSecurityContext();
}
}
use of org.sklsft.commons.rest.security.access.AccessControlType in project skeleton-commons by skeleton-software-community.
the class AccessControlAspect method getAccessControlType.
private AccessControlType getAccessControlType(ProceedingJoinPoint joinPoint) {
AccessControlType accessControlType = AccessControlType.PRIVATE;
Method proxiedMethod = ((MethodSignature) joinPoint.getSignature()).getMethod();
AccessControl accessControl = proxiedMethod.getAnnotation(AccessControl.class);
if (accessControl != null) {
accessControlType = accessControl.value();
}
return accessControlType;
}
Aggregations