Class OAuth2Object

    • Constructor Detail

      • OAuth2Object

        public OAuth2Object()
    • Method Detail

      • getProviders

        public List<NuxeoOAuth2ServiceProvider> getProviders​(@Context
                                                             javax.servlet.http.HttpServletRequest request)
        Lists all oauth2 service providers.
        Since:
        9.2
      • getProvider

        public javax.ws.rs.core.Response getProvider​(String providerId,
                                                     @Context
                                                     javax.servlet.http.HttpServletRequest request)
        Retrieves oauth2 data for a given provider.
      • addProvider

        public javax.ws.rs.core.Response addProvider​(@Context
                                                     javax.servlet.http.HttpServletRequest request,
                                                     NuxeoOAuth2ServiceProvider provider)
        Creates a new OAuth2 service provider.
        Since:
        9.2
      • updateProvider

        public javax.ws.rs.core.Response updateProvider​(String providerId,
                                                        @Context
                                                        javax.servlet.http.HttpServletRequest request,
                                                        NuxeoOAuth2ServiceProvider provider)
        Updates an OAuth2 service provider.
        Since:
        9.2
      • deleteProvider

        public javax.ws.rs.core.Response deleteProvider​(String providerId,
                                                        @Context
                                                        javax.servlet.http.HttpServletRequest request)
        Deletes an OAuth2 service provider.
        Since:
        9.2
      • getToken

        public javax.ws.rs.core.Response getToken​(String providerId,
                                                  @Context
                                                  javax.servlet.http.HttpServletRequest request)
                                           throws IOException
        Retrieves a valid access token for a given provider and the current user. If expired, the token will be refreshed.
        Throws:
        IOException
      • getTokens

        public List<NuxeoOAuth2Token> getTokens​(@Context
                                                javax.servlet.http.HttpServletRequest request)
        Retrieves all OAuth2 tokens.
        Since:
        9.2
      • searchTokens

        public List<NuxeoOAuth2Token> searchTokens​(String query)
        Search all oAuth2 tokens that match the query.
        Parameters:
        query - the query to match
        Since:
        11.1
      • getProviderToken

        public javax.ws.rs.core.Response getProviderToken​(String providerId,
                                                          String nxuser,
                                                          @Context
                                                          javax.servlet.http.HttpServletRequest request)
        Retrieves an OAuth2 provider token.
        Since:
        10.2
      • updateProviderToken

        public javax.ws.rs.core.Response updateProviderToken​(String providerId,
                                                             String nxuser,
                                                             @Context
                                                             javax.servlet.http.HttpServletRequest request,
                                                             NuxeoOAuth2Token token)
        Updates an OAuth2 provider token.
        Since:
        10.2
      • deleteProviderToken

        public javax.ws.rs.core.Response deleteProviderToken​(String providerId,
                                                             String nxuser,
                                                             @Context
                                                             javax.servlet.http.HttpServletRequest request)
        Deletes an OAuth2 provider token.
        Since:
        10.2
      • getProviderUserTokens

        public List<NuxeoOAuth2Token> getProviderUserTokens​(@Context
                                                            javax.servlet.http.HttpServletRequest request)
        Retrieves all oauth2 provider tokens for the current user.
        Since:
        10.2
      • getClientUserTokens

        public List<NuxeoOAuth2Token> getClientUserTokens​(@Context
                                                          javax.servlet.http.HttpServletRequest request)
        Retrieves all oauth2 client tokens for the current user.
        Since:
        10.2
      • getClientToken

        public javax.ws.rs.core.Response getClientToken​(String clientId,
                                                        String nxuser,
                                                        @Context
                                                        javax.servlet.http.HttpServletRequest request)
        Retrieves a oauth2 client token.
        Since:
        10.2
      • updateClientToken

        public javax.ws.rs.core.Response updateClientToken​(String clientId,
                                                           String nxuser,
                                                           @Context
                                                           javax.servlet.http.HttpServletRequest request,
                                                           NuxeoOAuth2Token token)
        Updates an OAuth2 client token.
        Since:
        10.2
      • deleteClientToken

        public javax.ws.rs.core.Response deleteClientToken​(String clientId,
                                                           String nxuser,
                                                           @Context
                                                           javax.servlet.http.HttpServletRequest request)
        Deletes a oauth2 client token.
        Since:
        10.2
      • getClients

        public List<OAuth2Client> getClients​(@Context
                                             javax.servlet.http.HttpServletRequest request)
        Retrieves oauth2 clients.
        Since:
        10.2
      • getClient

        public javax.ws.rs.core.Response getClient​(String clientId,
                                                   @Context
                                                   javax.servlet.http.HttpServletRequest request)
        Retrieves a oauth2 client.
        Since:
        10.2
      • createClient

        public javax.ws.rs.core.Response createClient​(OAuth2Client client)
        Creates a new oauth2 client.
        Parameters:
        client - the oAuth2Client to create
        Returns:
        the Response
        Since:
        11.1
      • updateClient

        public javax.ws.rs.core.Response updateClient​(String clientId,
                                                      OAuth2Client client)
        Updates the oauth2 client.
        Parameters:
        clientId - the oAuth2 client id to update
        client - the oAuth2Client to update
        Returns:
        the Response
        Since:
        11.1
      • deleteClient

        public javax.ws.rs.core.Response deleteClient​(String clientId)
        Deletes the oauth2 client.
        Parameters:
        clientId - the oAuth2 client id to delete
        Returns:
        the Response
        Since:
        11.1
      • deleteToken

        protected void deleteToken​(DocumentModel token)
      • buildResponse

        protected javax.ws.rs.core.Response buildResponse​(javax.ws.rs.core.Response.StatusType status,
                                                          Object obj)
                                                   throws IOException
        Throws:
        IOException
      • checkPermission

        protected void checkPermission()
      • checkPermission

        protected void checkPermission​(String nxuser)
      • checkNotAnonymousUser

        protected void checkNotAnonymousUser()