Class RemoteAPITokenServiceImpl

  • All Implemented Interfaces:
    RemoteAPITokenService

    @Service
    public class RemoteAPITokenServiceImpl
    extends java.lang.Object
    implements RemoteAPITokenService
    Service implementation for storing and reading remote api tokens
    • Constructor Detail

      • RemoteAPITokenServiceImpl

        @Autowired
        public RemoteAPITokenServiceImpl​(RemoteApiTokenRepository tokenRepository,
                                         UserRepository userRepository,
                                         org.apache.oltu.oauth2.client.OAuthClient oauthClient)
    • Method Detail

      • createTokenFromAuthCode

        @Transactional
        public RemoteAPIToken createTokenFromAuthCode​(java.lang.String authcode,
                                                      RemoteAPI remoteAPI,
                                                      java.lang.String tokenRedirect)
                                               throws org.apache.oltu.oauth2.common.exception.OAuthSystemException,
                                                      org.apache.oltu.oauth2.common.exception.OAuthProblemException
        Get a new token from the given auth code
        Specified by:
        createTokenFromAuthCode in interface RemoteAPITokenService
        Parameters:
        authcode - the auth code to create a token for
        remoteAPI - the remote api to get a token for
        tokenRedirect - a redirect url to get the token from
        Returns:
        a new token
        Throws:
        org.apache.oltu.oauth2.common.exception.OAuthSystemException - If building the token request fails
        org.apache.oltu.oauth2.common.exception.OAuthProblemException - If the token request fails
      • getOldTokenId

        protected RemoteAPIToken getOldTokenId​(RemoteAPIToken apiToken)
        Remove any old token for this user from the database
        Parameters:
        apiToken - the api token to remove.
        Returns:
        the token that was found.