Package org.saidone.unrest.platform
Class TicketInterceptor
java.lang.Object
org.saidone.unrest.platform.TicketInterceptor
- All Implemented Interfaces:
io.grpc.ServerInterceptor
Validates repository tickets and propagates the authenticated user through the gRPC context.
The exact credential-authentication RPC is passed through without a ticket. Every other RPC requires a
non-blank alfresco-ticket header that Alfresco accepts. The interceptor restores thread-local
Alfresco authentication immediately after validation and records the resulting username in USER. Only ticket lifecycle handlers also receive the validated ticket. Repository adapters establish
that identity again when executing their transaction callbacks.
Missing or invalid tickets close the call with UNAUTHENTICATED before the handler is invoked.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<ReqT,RespT>
io.grpc.ServerCall.Listener<ReqT> interceptCall(io.grpc.ServerCall<ReqT, RespT> call, io.grpc.Metadata headers, io.grpc.ServerCallHandler<ReqT, RespT> next) Allows credential authentication or validates the incoming ticket before starting a repository call.
-
Constructor Details
-
TicketInterceptor
public TicketInterceptor()
-
-
Method Details
-
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) Allows credential authentication or validates the incoming ticket before starting a repository call. Alfresco authentication is pushed and restored during validation; only the username is propagated through the gRPC context.- Specified by:
interceptCallin interfaceio.grpc.ServerInterceptor- Type Parameters:
ReqT- request message typeRespT- response message type- Parameters:
call- incoming RPC and its method descriptorheaders- request metadata containing alfresco-ticket for protected RPCsnext- downstream handler, invoked only after successful validation or for authentication- Returns:
- the downstream listener, or an inert listener after rejecting the call
-