Class SecurityInterceptor

java.lang.Object
org.springframework.security.access.intercept.AbstractSecurityInterceptor
org.lognet.springboot.grpc.security.SecurityInterceptor
All Implemented Interfaces:
io.grpc.ServerInterceptor, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationEventPublisherAware, org.springframework.context.MessageSourceAware, org.springframework.core.Ordered

public class SecurityInterceptor extends org.springframework.security.access.intercept.AbstractSecurityInterceptor implements io.grpc.ServerInterceptor, org.springframework.core.Ordered
  • Field Summary

    Fields inherited from class org.springframework.security.access.intercept.AbstractSecurityInterceptor

    logger, messages

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    SecurityInterceptor​(org.springframework.security.access.SecurityMetadataSource securityMetadataSource, AuthenticationSchemeSelector schemeSelector)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
     
    <ReqT,​ RespT>
    io.grpc.ServerCall.Listener<ReqT>
    interceptCall​(io.grpc.ServerCall<ReqT,​RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT,​RespT> next)
    Execute the same interceptor flow as original FilterSecurityInterceptor/MethodSecurityInterceptor { InterceptorStatusToken token = super.beforeInvocation(mi); Object result; try { result = mi.proceed(); } finally { super.finallyInvocation(token); } return super.afterInvocation(token, result); }
    org.springframework.security.access.SecurityMetadataSource
     
    void
     
    void
     
    void
     

    Methods inherited from class org.springframework.security.access.intercept.AbstractSecurityInterceptor

    afterInvocation, afterPropertiesSet, beforeInvocation, finallyInvocation, getAccessDecisionManager, getAfterInvocationManager, getAuthenticationManager, getRunAsManager, isAlwaysReauthenticate, isRejectPublicInvocations, isValidateConfigAttributes, setAccessDecisionManager, setAfterInvocationManager, setAlwaysReauthenticate, setApplicationEventPublisher, setAuthenticationManager, setMessageSource, setPublishAuthorizationSuccess, setRejectPublicInvocations, setRunAsManager, setSecurityContextHolderStrategy, setValidateConfigAttributes

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SecurityInterceptor

      public SecurityInterceptor(org.springframework.security.access.SecurityMetadataSource securityMetadataSource, AuthenticationSchemeSelector schemeSelector)
  • Method Details

    • setGRpcServicesRegistry

      @Autowired public void setGRpcServicesRegistry(GRpcServicesRegistry registry)
    • setFailureHandlingSupport

      @Autowired public void setFailureHandlingSupport(@Lazy FailureHandlingSupport failureHandlingSupport)
    • setConfig

      public void setConfig(GRpcServerProperties.SecurityProperties.Auth authCfg)
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • getSecureObjectClass

      public Class<?> getSecureObjectClass()
      Specified by:
      getSecureObjectClass in class org.springframework.security.access.intercept.AbstractSecurityInterceptor
    • obtainSecurityMetadataSource

      public org.springframework.security.access.SecurityMetadataSource obtainSecurityMetadataSource()
      Specified by:
      obtainSecurityMetadataSource in class org.springframework.security.access.intercept.AbstractSecurityInterceptor
    • interceptCall

      public <ReqT,​ RespT> io.grpc.ServerCall.Listener<ReqT> interceptCall(io.grpc.ServerCall<ReqT,​RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT,​RespT> next)
      Execute the same interceptor flow as original FilterSecurityInterceptor/MethodSecurityInterceptor { InterceptorStatusToken token = super.beforeInvocation(mi); Object result; try { result = mi.proceed(); } finally { super.finallyInvocation(token); } return super.afterInvocation(token, result); }
      Specified by:
      interceptCall in interface io.grpc.ServerInterceptor