Interface TokenResolver

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface TokenResolver
    This interface is for client side implementation, which can be used for initializing AsyncDocumentClient without passing master key, resource token and permission feed.

    Each time the SDK create request for CosmosDB, authorization token is generated based on that request at client side which enables creation of one AsyncDocumentClient per application shared across various users with different resource permissions.
    • Method Detail

      • getAuthorizationToken

        String getAuthorizationToken​(String requestVerb,
                                     String resourceIdOrFullName,
                                     CosmosResourceType resourceType,
                                     Map<String,​Object> properties)
        This method will consume the request information and based on that it will generate the authorization token.
        Parameters:
        properties - the user properties.
        requestVerb - Request verb i.e. GET, POST, PUT etc.
        resourceIdOrFullName - ResourceID or resource full name.
        resourceType - Resource type i.e. Database, DocumentCollection, Document etc.
        Returns:
        The authorization token.