Search in sources :

Example 1 with AccessControlType

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();
    }
}
Also used : TokenExtractionMode(org.sklsft.commons.rest.security.tokens.TokenExtractionMode) AccessControlType(org.sklsft.commons.rest.security.access.AccessControlType) Around(org.aspectj.lang.annotation.Around)

Example 2 with AccessControlType

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;
}
Also used : MethodSignature(org.aspectj.lang.reflect.MethodSignature) AccessControlType(org.sklsft.commons.rest.security.access.AccessControlType) Method(java.lang.reflect.Method) AccessControl(org.sklsft.commons.rest.security.annotations.AccessControl)

Aggregations

AccessControlType (org.sklsft.commons.rest.security.access.AccessControlType)2 Method (java.lang.reflect.Method)1 Around (org.aspectj.lang.annotation.Around)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1 AccessControl (org.sklsft.commons.rest.security.annotations.AccessControl)1 TokenExtractionMode (org.sklsft.commons.rest.security.tokens.TokenExtractionMode)1