public class TokenUtility
extends Object
Modifier and Type | Field and Description |
---|---|
static String |
HOST_ENVIRONMENT |
Modifier and Type | Method and Description |
---|---|
static void |
checkUserSetup(String clientId,
String clientSecret,
String tenant,
String subTenant,
TokenScope tokenType)
Verifies if mandatory user details available before requesting for token.
|
static String |
getAuthorizationToken(RestClientConfig config,
MindsphereCredentials creds)
Returns bearer token for the requested client.
|
static MindsphereCredentials |
getCredentialFromEnv(MindsphereCredentials creds)
Method to fetch credentials from sytem's environment variable if it has not
been provided
|
static String |
getEnvironmentSpecificGateWayUrl(RestClientConfig config)
Returns gate way URL specific to the configured environment
|
public static String getAuthorizationToken(RestClientConfig config, MindsphereCredentials creds) throws MindsphereException
config
- RestClientConfig having client configuration such as proxy
settings.creds
- Credentials object used by the client to set credentials.MindsphereException
- thrown if some error occurs while fetching the
token.public static MindsphereCredentials getCredentialFromEnv(MindsphereCredentials creds) throws MindsphereForbiddenAccessException
creds
- Credentials object used by the client to set credentialsMindsphereForbiddenAccessException
- thrown if clientId, clientSecret
and tenant details are not setpublic static void checkUserSetup(String clientId, String clientSecret, String tenant, String subTenant, TokenScope tokenType) throws MindsphereForbiddenAccessException
clientId
- Client id for authorization.clientSecret
- clientSecret for authorization.tenant
- tenant Id for authorization.subTenant
- subTenant Id for authorization.tokenType
- type of token for authorization.MindsphereForbiddenAccessException
- thrown if any of the mandatory
parameters is missing.public static String getEnvironmentSpecificGateWayUrl(RestClientConfig config)
config
- RestClientConfig instance to get the host environment (region)
value