Interface OAuthGenerator
-
public interface OAuthGenerator
ForTransferPlugins that base their authentication on OAuth, a generator class can be used to create the authentication URL and check the user-provided token. The concrete implementation of this interface should be provided to theTransferSettingsclass via theOAuthannotation.
A generator can be extended withOAuthGenerator.WithInterceptor,OAuthGenerator.WithExtractorandOAuthGenerator.WithNoRedirectMode.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceOAuthGenerator.WithExtractorUse a customOAuthTokenExtractorinstead of the default one which depends on theOAuthModein use.static interfaceOAuthGenerator.WithInterceptorUse a customOAuthTokenInterceptorinstead of the default one which depends on theOAuthModein use.static interfaceOAuthGenerator.WithNoRedirectModeIf an OAuth based plugin also supports copy&pasting a token from a website it should extend this interface.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcheckToken(java.lang.String token, java.lang.String csrfState)Validate the given token and (optional) csrf parameter.java.net.URIgenerateAuthUrl(java.net.URI redirectUri)Generate a URL which can be accessed by a user to authorize Syncany
-
-
-
Method Detail
-
generateAuthUrl
java.net.URI generateAuthUrl(java.net.URI redirectUri) throws StorageException
Generate a URL which can be accessed by a user to authorize Syncany- Parameters:
redirectUri- The URL to which the OAuth provider should redirect in any case (either success or failure)- Returns:
- A URL to authorize Syncany using the provided redirectUri
- Throws:
StorageException
-
checkToken
void checkToken(java.lang.String token, java.lang.String csrfState) throws StorageException
Validate the given token and (optional) csrf parameter.- Parameters:
token- Token provided byOAuthTokenWebListener.csrfState- Content of the state parameter (optional).- Throws:
StorageException
-
-