use of com.google.api.client.auth.oauth2.ClientParametersAuthentication in project che by eclipse.
the class OAuthAuthenticator method configure.
/**
* This method should be invoked by child class for initialization default instance of {@link AuthorizationCodeFlow}
* that will be used for authorization
*/
protected void configure(String clientId, String clientSecret, String[] redirectUris, String authUri, String tokenUri, MemoryDataStoreFactory dataStoreFactory, List<String> scopes) throws IOException {
final AuthorizationCodeFlow authorizationFlow = new AuthorizationCodeFlow.Builder(BearerToken.authorizationHeaderAccessMethod(), new NetHttpTransport(), new JacksonFactory(), new GenericUrl(tokenUri), new ClientParametersAuthentication(clientId, clientSecret), clientId, authUri).setDataStoreFactory(dataStoreFactory).setScopes(scopes).build();
LOG.debug("clientId={}, clientSecret={}, redirectUris={} , authUri={}, tokenUri={}, dataStoreFactory={}", clientId, clientSecret, redirectUris, authUri, tokenUri, dataStoreFactory);
configure(authorizationFlow, Arrays.asList(redirectUris));
}
use of com.google.api.client.auth.oauth2.ClientParametersAuthentication in project openhab1-addons by openhab.
the class GCalGoogleOAuth method newCredential.
private static Credential newCredential(String userId, DataStore<StoredCredential> credentialDataStore) {
Credential.Builder builder = new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).setTransport(HTTP_TRANSPORT).setJsonFactory(JSON_FACTORY).setTokenServerEncodedUrl("https://accounts.google.com/o/oauth2/token").setClientAuthentication(new ClientParametersAuthentication(client_id, client_secret)).setRequestInitializer(null).setClock(Clock.SYSTEM);
builder.addRefreshListener(new DataStoreCredentialRefreshListener(userId, credentialDataStore));
return builder.build();
}
Aggregations