Class TicketInterceptor

java.lang.Object
org.saidone.unrest.platform.TicketInterceptor
All Implemented Interfaces:
io.grpc.ServerInterceptor

public final class TicketInterceptor extends Object implements 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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      interceptCall in interface io.grpc.ServerInterceptor
      Type Parameters:
      ReqT - request message type
      RespT - response message type
      Parameters:
      call - incoming RPC and its method descriptor
      headers - request metadata containing alfresco-ticket for protected RPCs
      next - downstream handler, invoked only after successful validation or for authentication
      Returns:
      the downstream listener, or an inert listener after rejecting the call