Class TwitchIdentityProvider

java.lang.Object
com.github.philippheuer.credentialmanager.domain.IdentityProvider
com.github.philippheuer.credentialmanager.identityprovider.OAuth2IdentityProvider
com.github.twitch4j.auth.providers.TwitchIdentityProvider

public class TwitchIdentityProvider extends com.github.philippheuer.credentialmanager.identityprovider.OAuth2IdentityProvider
Twitch Identity Provider
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     

    Fields inherited from class com.github.philippheuer.credentialmanager.identityprovider.OAuth2IdentityProvider

    authUrl, clientId, clientSecret, deviceUrl, httpClient, OBJECTMAPPER, redirectUrl, responseType, scopeSeperator, tokenEndpointPostType, tokenUrl

    Fields inherited from class com.github.philippheuer.credentialmanager.domain.IdentityProvider

    configuration, credentialManager, providerName, providerType
  • Constructor Summary

    Constructors
    Constructor
    Description
    TwitchIdentityProvider(String clientId, String clientSecret, String redirectUrl)
    Constructor
    TwitchIdentityProvider(String clientId, String clientSecret, String redirectUrl, String baseUrl)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<com.github.philippheuer.credentialmanager.domain.OAuth2Credential>
    getAdditionalCredentialInformation(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential)
    Get Auth Token Information
    isCredentialValid(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential)
    Checks whether an OAuth2Credential is valid.
    boolean
    revokeCredential(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential)
    Revokes an access token.

    Methods inherited from class com.github.philippheuer.credentialmanager.identityprovider.OAuth2IdentityProvider

    createDeviceFlowRequest, enableLoggingInterceptor, getAppAccessToken, getAppAccessToken, getAuthenticationUrl, getAuthenticationUrl, getCredentialByCode, getCredentialByUsernameAndPassword, getDeviceAccessToken, getScopedCredentialByUsernameAndPassword, isValid, refreshCredential, renew

    Methods inherited from class com.github.philippheuer.credentialmanager.domain.IdentityProvider

    canEqual, equals, getConfiguration, getCredentialManager, getProviderName, getProviderType, hashCode, setConfiguration, setCredentialManager, setProviderName, setProviderType, toString

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • TwitchIdentityProvider

      public TwitchIdentityProvider(String clientId, String clientSecret, String redirectUrl)
      Constructor
      Parameters:
      clientId - OAuth Client Id
      clientSecret - OAuth Client Secret
      redirectUrl - Redirect Url
    • TwitchIdentityProvider

      @VisibleForTesting public TwitchIdentityProvider(String clientId, String clientSecret, String redirectUrl, String baseUrl)
  • Method Details

    • isCredentialValid

      public Optional<Boolean> isCredentialValid(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential)
      Checks whether an OAuth2Credential is valid.

      Expired tokens will yield false (assuming the network request succeeds).

      Parameters:
      credential - the OAuth credential to check
      Returns:
      whether the token is valid, or empty if the network request did not succeed
    • getAdditionalCredentialInformation

      public Optional<com.github.philippheuer.credentialmanager.domain.OAuth2Credential> getAdditionalCredentialInformation(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential)
      Get Auth Token Information
      Specified by:
      getAdditionalCredentialInformation in class com.github.philippheuer.credentialmanager.identityprovider.OAuth2IdentityProvider
      Parameters:
      credential - OAuth2 Credential
    • revokeCredential

      public boolean revokeCredential(com.github.philippheuer.credentialmanager.domain.OAuth2Credential credential)
      Revokes an access token.

      The clientId passed to TwitchIdentityProvider must match that used to create the credential

      Parameters:
      credential - the OAuth2Credential to be revoked
      Returns:
      whether the credential was successfully revoked