Class SecurityInterceptor
- java.lang.Object
-
- org.springframework.security.access.intercept.AbstractSecurityInterceptor
-
- org.lognet.springboot.grpc.security.SecurityInterceptor
-
- All Implemented Interfaces:
io.grpc.ServerInterceptor,FailureHandlingServerInterceptor,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 FailureHandlingServerInterceptor, org.springframework.core.Ordered
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.lognet.springboot.grpc.FailureHandlingServerInterceptor
FailureHandlingServerInterceptor.MessageBlockingServerCallListener<R>
-
-
Constructor Summary
Constructors Constructor Description SecurityInterceptor(GrpcSecurityMetadataSource securedMethods, AuthenticationSchemeSelector schemeSelector)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetOrder()java.lang.Class<?>getSecureObjectClass()<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); }GrpcSecurityMetadataSourceobtainSecurityMetadataSource()voidsetConfig(GRpcServerProperties.SecurityProperties.Auth authCfg)voidsetErrorHandler(java.util.Optional<GRpcErrorHandler> errorHandler)-
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, setValidateConfigAttributes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.lognet.springboot.grpc.FailureHandlingServerInterceptor
closeCall
-
-
-
-
Constructor Detail
-
SecurityInterceptor
public SecurityInterceptor(GrpcSecurityMetadataSource securedMethods, AuthenticationSchemeSelector schemeSelector)
-
-
Method Detail
-
setErrorHandler
@Autowired public void setErrorHandler(java.util.Optional<GRpcErrorHandler> errorHandler)
-
setConfig
public void setConfig(GRpcServerProperties.SecurityProperties.Auth authCfg)
-
getOrder
public int getOrder()
- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-
getSecureObjectClass
public java.lang.Class<?> getSecureObjectClass()
- Specified by:
getSecureObjectClassin classorg.springframework.security.access.intercept.AbstractSecurityInterceptor
-
obtainSecurityMetadataSource
public GrpcSecurityMetadataSource obtainSecurityMetadataSource()
- Specified by:
obtainSecurityMetadataSourcein classorg.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:
interceptCallin interfaceio.grpc.ServerInterceptor
-
-