Package net.troja.eve.esi.auth
Class OAuth
- java.lang.Object
-
- net.troja.eve.esi.auth.OAuth
-
- All Implemented Interfaces:
Authentication
- Direct Known Subclasses:
RetryingOAuth
public class OAuth extends Object implements Authentication
-
-
Constructor Summary
Constructors Constructor Description OAuth()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapplyToParams(List<Pair> queryParams, Map<String,String> headerParams, Map<String,String> cookieParams)Apply authentication settings to header and query params.voidfinishFlow(String code, String state)Finish the oauth flow after the user was redirected back.voidfinishFlow(String code, String state, String codeVerifier)Finish the oauth flow after the user was redirected back.StringgetAccessToken()StringgetAuthorizationUri(String redirectUri, Set<String> scopes, String state)Get the authorization uri, where the user logs in.StringgetClientId()StringgetCodeVerifier()JWTgetJWT()Get JWT (JSON Web Token) WARNING: The JWT is unverified.StringgetRefreshToken()voidsetAccessToken(String accessToken)voidsetAuth(String clientId, String refreshToken)voidsetClientId(String clientId)
-
-
-
Method Detail
-
applyToParams
public void applyToParams(List<Pair> queryParams, Map<String,String> headerParams, Map<String,String> cookieParams)
Description copied from interface:AuthenticationApply authentication settings to header and query params.- Specified by:
applyToParamsin interfaceAuthentication- Parameters:
queryParams- List of query parametersheaderParams- Map of header parameterscookieParams- Map of cookie parameters
-
setAccessToken
public void setAccessToken(String accessToken)
-
getRefreshToken
public String getRefreshToken()
-
getClientId
public String getClientId()
-
setClientId
public void setClientId(String clientId)
-
getAccessToken
public String getAccessToken()
-
getJWT
public JWT getJWT()
Get JWT (JSON Web Token) WARNING: The JWT is unverified. Verifying the JWT is beyond the scope of this library. As ESI will verify the token when used. See the SSO documentation for JWT Token validation for details: https://github.com/esi/esi-docs/blob/master/docs/sso/validating_eve_jwt .md- Returns:
- Unverified JWT or null
-
getAuthorizationUri
public String getAuthorizationUri(String redirectUri, Set<String> scopes, String state)
Get the authorization uri, where the user logs in.- Parameters:
redirectUri- Uri the user is redirected to, after successful authorization. This must be the same as specified at the Eve Online developer page.scopes- Scopes of the Eve Online SSO.state- This should be some secret to prevent XRSF, please read: http://www.thread-safe.com/2014/05/the-correct-use-of-state- parameter-in.html- Returns:
-
getCodeVerifier
public String getCodeVerifier()
- Returns:
- the PKCE code verifier used to generate the last code challenge (RFC 7636)
-
finishFlow
public void finishFlow(String code, String state, String codeVerifier) throws ApiException
Finish the oauth flow after the user was redirected back.- Parameters:
code- Code returned by the Eve Online SSOstate- This should be some secret to prevent XRSF see getAuthorizationUricodeVerifier- The PKCE code verifier used to generate the code challenge (RFC 7636). Required if not called by the same instance that called `getAuthorizationUri`- Throws:
ApiException
-
finishFlow
public void finishFlow(String code, String state) throws ApiException
Finish the oauth flow after the user was redirected back.- Parameters:
code- Code returned by the Eve Online SSOstate- This should be some secret to prevent XRSF see getAuthorizationUri- Throws:
ApiException
-
-