Package com.esprit.utils
Enum Class SignInGoogle
- All Implemented Interfaces:
Serializable
,Comparable<SignInGoogle>
,Constable
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Logger
private static final String
private static final SecureRandom
private static final String
private static com.github.scribejava.core.oauth.OAuth20Service
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Initialize Google Sign-In flowstatic SignInGoogle
Returns the enum constant of this class with the specified name.static SignInGoogle[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.static boolean
verifyAuthUrl
(String code) Complete the OAuth flow with the authorization code
-
Field Details
-
LOGGER
-
RANDOM
-
SECRET_STATE
-
PROTECTED_RESOURCE_URL
- See Also:
-
service
private static com.github.scribejava.core.oauth.OAuth20Service service
-
-
Constructor Details
-
SignInGoogle
private SignInGoogle()
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
signInWithGoogle
public static String signInWithGoogle() throws InterruptedException, ExecutionException, IOExceptionInitialize Google Sign-In flow- Returns:
- Authorization URL for the user to visit
- Throws:
InterruptedException
- if the operation is interruptedExecutionException
- if the operation failsIOException
- if there's an I/O errorIllegalStateException
- if required environment variables are missing
-
verifyAuthUrl
public static boolean verifyAuthUrl(String code) throws IOException, ExecutionException, InterruptedException Complete the OAuth flow with the authorization code- Parameters:
code
- The authorization code from Google- Returns:
- true if authentication was successful
- Throws:
IOException
- if there's an I/O errorExecutionException
- if the operation failsInterruptedException
- if the operation is interrupted
-