Package 

Class BinderTransportSecurity


  • 
    public final class BinderTransportSecurity
    
                        

    Manages security for an Android Service hosted gRPC server.

    Attaches authorization state to a newly-created transport, and contains a ServerInterceptor which ensures calls are authorized before allowing them to proceed.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public interface BinderTransportSecurity.ServerPolicyChecker

      Decides whether a given Android UID is authorized to access some resource.

      This class provides the asynchronous version of io.grpc.binder.SecurityPolicy,allowing implementations of authorization logic that involves slow or asynchronous callswithout necessarily blocking the calling thread.

    • Method Summary

      Modifier and Type Method Description
      static void installAuthInterceptor(ServerBuilder<out Object> serverBuilder) Install a security policy on an about-to-be created server.
      static void attachAuthAttrs(Attributes.Builder builder, int remoteUid, BinderTransportSecurity.ServerPolicyChecker serverPolicyChecker, Executor executor) Attach the given security policy to the transport attributes being built.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • installAuthInterceptor

        @Internal() static void installAuthInterceptor(ServerBuilder<out Object> serverBuilder)

        Install a security policy on an about-to-be created server.

        Parameters:
        serverBuilder - The ServerBuilder being used to create the server.
      • attachAuthAttrs

        @Internal() static void attachAuthAttrs(Attributes.Builder builder, int remoteUid, BinderTransportSecurity.ServerPolicyChecker serverPolicyChecker, Executor executor)

        Attach the given security policy to the transport attributes being built. Will be used by theauth interceptor to confirm accept or reject calls.

        Parameters:
        builder - The Attributes.Builder for the transport being created.
        remoteUid - The remote UID of the transport.
        serverPolicyChecker - The policy checker for this transport.
        executor - used for calling into the application.