Package org.gcube.oidc.rest
Class OpenIdConnectRESTHelper
java.lang.Object
org.gcube.oidc.rest.OpenIdConnectRESTHelper
public class OpenIdConnectRESTHelper extends Object
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Loggerlogger -
Constructor Summary
Constructors Constructor Description OpenIdConnectRESTHelper() -
Method Summary
Modifier and Type Method Description static StringbuildLoginRequestURL(URL loginURL, String clientId, String state, String redirectURI)protected static StringgetClientIdFromToken(JWTToken token)static byte[]getUserAvatar(URL avatarURL, String authorization)static byte[]getUserAvatar(URL avatarURL, JWTToken token)static booleanisAccessDeniedNotAuthorizedError(String jsonString)static booleanisInvalidBearerTokenError(String jsonString)static booleanisTokenNotActiveError(String jsonString)static booleanlogout(URL logoutUrl, String clientId, JWTToken token)static booleanlogout(URL logoutUrl, JWTToken token)static StringmapToQueryString(Map<String,List<String>> params)protected static booleanmatchesErrorAndDescription(String jsonString, String expectedError, String exepectedErrorDescription)static JWTTokenperformQueryTokenWithPOST(URL tokenURL, String authorization, Map<String,List<String>> params)protected static HttpURLConnectionperformURLEncodedPOSTSendData(URL url, Map<String,List<String>> params, String authorization)static JWTTokenqueryClientToken(String clientId, String clientSecret, URL tokenURL)static JWTTokenqueryToken(String clientId, URL tokenURL, String code, String scope, String redirectURI)static JWTTokenqueryUMAToken(URL tokenUrl, String authorizationToken, String audience, List<String> permissions)static JWTTokenrefreshToken(URL tokenURL, String clientId, String clientSecret, JWTToken token)static JWTTokenrefreshToken(URL tokenURL, String clientId, JWTToken token)static JWTTokenrefreshToken(URL tokenURL, JWTToken token)
-
Field Details
-
logger
protected static final org.slf4j.Logger logger
-
-
Constructor Details
-
OpenIdConnectRESTHelper
public OpenIdConnectRESTHelper()
-
-
Method Details
-
buildLoginRequestURL
public static String buildLoginRequestURL(URL loginURL, String clientId, String state, String redirectURI) throws UnsupportedEncodingException- Throws:
UnsupportedEncodingException
-
mapToQueryString
-
queryClientToken
public static JWTToken queryClientToken(String clientId, String clientSecret, URL tokenURL) throws OpenIdConnectRESTHelperException- Throws:
OpenIdConnectRESTHelperException
-
queryToken
public static JWTToken queryToken(String clientId, URL tokenURL, String code, String scope, String redirectURI) throws Exception- Throws:
Exception
-
performQueryTokenWithPOST
public static JWTToken performQueryTokenWithPOST(URL tokenURL, String authorization, Map<String,List<String>> params) throws OpenIdConnectRESTHelperException- Throws:
OpenIdConnectRESTHelperException
-
performURLEncodedPOSTSendData
protected static HttpURLConnection performURLEncodedPOSTSendData(URL url, Map<String,List<String>> params, String authorization) throws IOException, ProtocolException, UnsupportedEncodingException -
queryUMAToken
public static JWTToken queryUMAToken(URL tokenUrl, String authorizationToken, String audience, List<String> permissions) throws OpenIdConnectRESTHelperException- Throws:
OpenIdConnectRESTHelperException
-
refreshToken
public static JWTToken refreshToken(URL tokenURL, JWTToken token) throws OpenIdConnectRESTHelperException- Throws:
OpenIdConnectRESTHelperException
-
refreshToken
public static JWTToken refreshToken(URL tokenURL, String clientId, JWTToken token) throws OpenIdConnectRESTHelperException- Throws:
OpenIdConnectRESTHelperException
-
refreshToken
public static JWTToken refreshToken(URL tokenURL, String clientId, String clientSecret, JWTToken token) throws OpenIdConnectRESTHelperException- Throws:
OpenIdConnectRESTHelperException
-
getClientIdFromToken
-
logout
- Throws:
IOException
-
logout
- Throws:
IOException
-
getUserAvatar
-
getUserAvatar
-
matchesErrorAndDescription
-
isTokenNotActiveError
-
isInvalidBearerTokenError
-
isAccessDeniedNotAuthorizedError
-