com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier Java Examples
The following examples show how to use
com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Authenticator.java From styx with Apache License 2.0 | 6 votes |
Authenticator(GoogleIdTokenVerifier googleIdTokenVerifier, CloudResourceManager cloudResourceManager, Iam iam, AuthenticatorConfiguration configuration, WaitStrategy retryWaitStrategy, StopStrategy retryStopStrategy) { this.googleIdTokenVerifier = Objects.requireNonNull(googleIdTokenVerifier, "googleIdTokenVerifier"); this.cloudResourceManager = Objects.requireNonNull(cloudResourceManager, "cloudResourceManager"); this.iam = Objects.requireNonNull(iam, "iam"); this.domainWhitelist = configuration.domainWhitelist(); this.resourceWhitelist = configuration.resourceWhitelist(); this.allowedAudiences = configuration.allowedAudiences(); this.retryWaitStrategy = Objects.requireNonNull(retryWaitStrategy, "retryWaitStrategy"); this.retryStopStrategy = Objects.requireNonNull(retryStopStrategy, "retryStopStrategy"); }
Example #2
Source File: SocialLogin.java From PYX-Reloaded with Apache License 2.0 | 5 votes |
@Contract("null -> null") @Nullable private static GoogleIdTokenVerifier instantiateGoogleHelper(String appId) { if (appId == null || appId.isEmpty()) return null; return new GoogleIdTokenVerifier.Builder(new GoogleApacheHttpTransport(), new JacksonFactory()) .setAudience(Collections.singletonList(appId)) .build(); }
Example #3
Source File: Authenticator.java From styx with Apache License 2.0 | 5 votes |
Authenticator(GoogleIdTokenVerifier googleIdTokenVerifier, CloudResourceManager cloudResourceManager, Iam iam, AuthenticatorConfiguration configuration) { this(googleIdTokenVerifier, cloudResourceManager, iam, configuration, DEFAULT_RETRY_WAIT_STRATEGY, DEFAULT_RETRY_STOP_STRATEGY); }
Example #4
Source File: GoogleIdTokenVerifierTest.java From styx with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { final var keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(571); KeyPair pair = keyGen.generateKeyPair(); privateKey = pair.getPrivate(); final var keysManager = new GooglePublicKeysManager(Utils.getDefaultTransport(), Utils.getDefaultJsonFactory()); stubPublicKey(keysManager, pair.getPublic()); verifier = new GoogleIdTokenVerifier(keysManager); }
Example #5
Source File: AuthenticatorFactoryTest.java From styx with Apache License 2.0 | 5 votes |
@Test public void shouldBuildGoogleIdTokenVerifier() { final GoogleIdTokenVerifier googleIdTokenVerifier = new DefaultAuthenticatorFactory() .buildGoogleIdTokenVerifier(httpTransport, jsonFactory); assertThat(googleIdTokenVerifier.getTransport(), is(httpTransport)); assertThat(googleIdTokenVerifier.getJsonFactory(), is(jsonFactory)); }
Example #6
Source File: EndpointsPeerAuthenticator.java From endpoints-java with Apache License 2.0 | 5 votes |
public EndpointsPeerAuthenticator() { Client client = Client.getInstance(); GooglePublicKeysManager keyManager = new GooglePublicKeysManager.Builder( client.getHttpTransport(), client.getJsonFactory()).setPublicCertsEncodedUrl( PUBLIC_CERT_URL).build(); GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(keyManager).setIssuer(ISSUER).build(); jwtAuthenticator = new GoogleJwtAuthenticator(verifier); }
Example #7
Source File: Checker.java From gplus-verifytoken-java with Apache License 2.0 | 5 votes |
public Checker(String[] clientIDs, String audience) { mClientIDs = Arrays.asList(clientIDs); mAudience = audience; NetHttpTransport transport = new NetHttpTransport(); mJFactory = new GsonFactory(); mVerifier = new GoogleIdTokenVerifier(transport, mJFactory); }
Example #8
Source File: Checker.java From gplus-verifytoken-java with Apache License 2.0 | 5 votes |
public Checker(String[] clientIDs, String audience) { mClientIDs = Arrays.asList(clientIDs); mAudience = audience; NetHttpTransport transport = new NetHttpTransport(); mJFactory = new GsonFactory(); mVerifier = new GoogleIdTokenVerifier(transport, mJFactory); }
Example #9
Source File: GoogleSecurityServiceSupplier.java From Knowage-Server with GNU Affero General Public License v3.0 | 4 votes |
private GoogleIdToken verifyToken(String token) throws GeneralSecurityException, IOException { GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(new NetHttpTransport(), JacksonFactory.getDefaultInstance()) .setAudience(Collections.singletonList(GoogleSignInConfig.getClientId())).build(); GoogleIdToken idToken = verifier.verify(token); return idToken; }
Example #10
Source File: AuthenticatorFactory.java From styx with Apache License 2.0 | 4 votes |
@VisibleForTesting GoogleIdTokenVerifier buildGoogleIdTokenVerifier(HttpTransport httpTransport, JsonFactory jsonFactory) { return new GoogleIdTokenVerifier(httpTransport, jsonFactory); }
Example #11
Source File: AuthenticatorFactoryTest.java From styx with Apache License 2.0 | 4 votes |
@Override GoogleIdTokenVerifier buildGoogleIdTokenVerifier(HttpTransport httpTransport, JsonFactory jsonFactory) { return googleIdTokenVerifier; }
Example #12
Source File: GoogleJwtAuthenticator.java From endpoints-java with Apache License 2.0 | 4 votes |
public GoogleJwtAuthenticator() { this(new GoogleIdTokenVerifier.Builder(Client.getInstance().getHttpTransport(), Client.getInstance().getJsonFactory()).build()); }
Example #13
Source File: GoogleJwtAuthenticator.java From endpoints-java with Apache License 2.0 | 4 votes |
public GoogleJwtAuthenticator(GoogleIdTokenVerifier verifier) { this.verifier = verifier; }