use of org.sklsft.commons.rest.security.tokens.TokenExtractionMode 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.tokens.TokenExtractionMode in project skeleton-commons by skeleton-software-community.
the class AccessControlAspect method getTokenExtractionMode.
private TokenExtractionMode getTokenExtractionMode(ProceedingJoinPoint joinPoint) {
TokenExtractionMode tokenExtractionMode = TokenExtractionMode.HEADER;
Method proxiedMethod = ((MethodSignature) joinPoint.getSignature()).getMethod();
AccessControl accessControl = proxiedMethod.getAnnotation(AccessControl.class);
if (accessControl != null) {
tokenExtractionMode = accessControl.tokenExtractionMode();
}
return tokenExtractionMode;
}
Aggregations