Package com.google.api.client.auth.oauth2

Examples of com.google.api.client.auth.oauth2.AuthorizationCodeFlowTest


      throws ServletException, IOException {
    StringBuffer buf = req.getRequestURL();
    if (req.getQueryString() != null) {
      buf.append('?').append(req.getQueryString());
    }
    AuthorizationCodeResponseUrl responseUrl = new AuthorizationCodeResponseUrl(buf.toString());
    String code = responseUrl.getCode();
    if (responseUrl.getError() != null) {
      onError(req, resp, responseUrl);
    } else if (code == null) {
      resp.setStatus(HttpServletResponse.SC_BAD_REQUEST);
      resp.getWriter().print("Missing authorization code");
    } else {
View Full Code Here


   */
  public GoogleRefreshTokenRequest(HttpTransport transport, JsonFactory jsonFactory,
      String refreshToken, String clientId, String clientSecret) {
    super(transport, jsonFactory, new GenericUrl(GoogleOAuthConstants.TOKEN_SERVER_URL),
        refreshToken);
    setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret));
  }
View Full Code Here

        String clientSecret, Iterable<String> scopes) {
      super(BearerToken.authorizationHeaderAccessMethod(),
          transport,
          jsonFactory,
          new GenericUrl(GoogleOAuthConstants.TOKEN_SERVER_URL),
          new ClientParametersAuthentication(clientId, clientSecret),
          clientId,
          GoogleOAuthConstants.AUTHORIZATION_SERVER_URL);
      setScopes(Preconditions.checkNotNull(scopes));
    }
View Full Code Here

        GoogleClientSecrets clientSecrets, Iterable<String> scopes) {
      super(BearerToken.authorizationHeaderAccessMethod(),
          transport,
          jsonFactory,
          new GenericUrl(GoogleOAuthConstants.TOKEN_SERVER_URL),
          new ClientParametersAuthentication(clientSecrets.getDetails().getClientId(),
              clientSecrets.getDetails().getClientSecret()),
          clientSecrets.getDetails().getClientId(),
          GoogleOAuthConstants.AUTHORIZATION_SERVER_URL);
      setScopes(Preconditions.checkNotNull(scopes));
    }
View Full Code Here

      String clientId,
      String clientSecret,
      String code,
      String redirectUri) {
    super(transport, jsonFactory, new GenericUrl(GoogleOAuthConstants.TOKEN_SERVER_URL), code);
    setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret));
    setRedirectUri(redirectUri);
  }
View Full Code Here

     * Overriding is only supported for the purpose of calling the super implementation and changing
     * the return type, but nothing else.
     * </p>
     */
    public Builder setClientSecrets(String clientId, String clientSecret) {
      setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret));
      return this;
    }
View Full Code Here

     * </p>
     */
    public Builder setClientSecrets(GoogleClientSecrets clientSecrets) {
      Details details = clientSecrets.getDetails();
      setClientAuthentication(
          new ClientParametersAuthentication(details.getClientId(), details.getClientSecret()));
      return this;
    }
View Full Code Here

            new JacksonFactory(),
            CLIENT_ID,
            CLIENT_SECRET,
            CODE,
            REDIRECT_URI);
    ClientParametersAuthentication clientAuthentication =
        (ClientParametersAuthentication) request.getClientAuthentication();
    assertEquals(CLIENT_ID, clientAuthentication.getClientId());
    assertEquals(CLIENT_SECRET, clientAuthentication.getClientSecret());
    assertEquals(CODE, request.getCode());
    assertEquals(REDIRECT_URI, request.getRedirectUri());
    assertEquals("authorization_code", request.getGrantType());
    assertNull(request.getScopes());
    assertNotNull(request.getTokenServerUrl());
View Full Code Here

     * Overriding is only supported for the purpose of calling the super implementation and changing
     * the return type, but nothing else.
     * </p>
     */
    public Builder setClientSecrets(String clientId, String clientSecret) {
      setClientAuthentication(new ClientParametersAuthentication(clientId, clientSecret));
      return this;
    }
View Full Code Here

     * </p>
     */
    public Builder setClientSecrets(GoogleClientSecrets clientSecrets) {
      Details details = clientSecrets.getDetails();
      setClientAuthentication(
          new ClientParametersAuthentication(details.getClientId(), details.getClientSecret()));
      return this;
    }
View Full Code Here

TOP

Related Classes of com.google.api.client.auth.oauth2.AuthorizationCodeFlowTest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.