if (this.context != null) { System.out.println("xx"); } else { System.out.println("null"); }
    protected InterceptorStatusToken beforeInvocation(Object object) {        if (this.context != null) {            System.out.println("xx");        } else {            System.out.println("null");        }        if (object == null) {            throw new IllegalArgumentException("Object was null");        }        if (!this.obtainObjectDefinitionSource().supports(object.getClass())) {            throw new IllegalArgumentException(                "ObjectDefinitionSource does not support objects of type "                + object.getClass());        }        ConfigAttributeDefinition attr = this.obtainObjectDefinitionSource()                                             .getAttributes(object);        if (attr != null) {            if (logger.isDebugEnabled()) {                logger.debug("Secure object: " + object.toString()                    + "; ConfigAttributes: " + attr.toString());            }            // Ensure ContextHolder presents a populated SecureContext            if ((ContextHolder.getContext() == null)                || !(ContextHolder.getContext() instanceof SecureContext)) {                credentialsNotFound("A valid SecureContext was not provided in the RequestContext",                    object, attr);            }            SecureContext context = (SecureContext) ContextHolder.getContext();            // We check for just the property we're interested in (we do            // not call Context.validate() like the ContextInterceptor)            if (context.getAuthentication() == null) {                credentialsNotFound("Authentication credentials were not found in the SecureContext",                    object, attr);            }            // Attempt authentication            Authentication authenticated;            try {                authenticated = this.authenticationManager.authenticate(context                        .getAuthentication());            } catch (AuthenticationException authenticationException) {                if (this.context != null) {                    AuthenticationFailureEvent event = new AuthenticationFailureEvent(object,                            attr, context.getAuthentication(),                            authenticationException);                    this.context.publishEvent(event);                }                throw authenticationException;            }            authenticated.setAuthenticated(true);            if (logger.isDebugEnabled()) {                logger.debug("Authenticated: " + authenticated.toString());            }            context.setAuthentication(authenticated);            ContextHolder.setContext((Context) context);            // Attempt authorization            try {                this.accessDecisionManager.decide(authenticated, object, attr);            } catch (AccessDeniedException accessDeniedException) {                if (this.context != null) {                    AuthorizationFailureEvent event = new AuthorizationFailureEvent(object,                            attr, authenticated, accessDeniedException);                    this.context.publishEvent(event);                }                throw accessDeniedException;            }            if (logger.isDebugEnabled()) {                logger.debug("Authorization successful");            }            if (this.context != null) {                AuthorizedEvent event = new AuthorizedEvent(object, attr,                        authenticated);                this.context.publishEvent(event);            }            // Attempt to run as a different user            Authentication runAs = this.runAsManager.buildRunAs(authenticated,                    object, attr);            if (runAs == null) {                if (logger.isDebugEnabled()) {                    logger.debug(                        "RunAsManager did not change Authentication object");                }                return null; // no further work post-invocation            } else {                if (logger.isDebugEnabled()) {                    logger.debug("Switching to RunAs Authentication: "                        + runAs.toString());                }                context.setAuthentication(runAs);                ContextHolder.setContext((Context) context);                InterceptorStatusToken token = new InterceptorStatusToken();                token.setAuthenticated(authenticated);                return token; // revert to token.Authenticated post-invocation            }        } else {            if (logger.isDebugEnabled()) {                logger.debug("Public object - authentication not attempted");            }            if (this.context != null) {                this.context.publishEvent(new PublicInvocationEvent(object));            }            // Set Authentication object (if it exists) to be unauthenticated            if ((ContextHolder.getContext() != null)                && ContextHolder.getContext() instanceof SecureContext) {                SecureContext context = (SecureContext) ContextHolder                    .getContext();                if (context.getAuthentication() != null) {                    if (logger.isDebugEnabled()) {                        logger.debug(                            "Authentication object detected and tagged as unauthenticated");                    }                    Authentication authenticated = context.getAuthentication();                    authenticated.setAuthenticated(false);                    context.setAuthentication(authenticated);                    ContextHolder.setContext((Context) context);                }            }            return null; // no further work post-invocation        }    }