Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2011 Google Inc.
   *
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
   * in compliance with the License. You may obtain a copy of the License at
   *
   * http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software distributed under the License
  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
 
 package com.google.api.client.extensions.appengine.auth.helpers;
 
 
 
Implementation of credentials that is used to communicate with resources managed on behalf of an App Engine application.

Deprecated:
(scheduled to be removed in 1.8) Use com.google.api.client.googleapis.extensions.appengine.auth.oauth2.AppIdentityCredential from google-api-java-client
Author(s):
moshenko@google.com (Jake Moshenko)
Since:
1.6
 
 public final class AppAssertionCredential implements Credential {
 
   static final Logger LOGGER = Logger.getLogger(AppAssertionCredential.class.getName());
 
   private static final Method AUTHORIZATION_METHOD = .;

  
Primary key for this data object, this is usually the name of the app engine application.
 
   @SuppressWarnings("unused")
   private String applicationName;

  
Access token to use for OAuth2 authenticated requests or null for none.
 
   private String accessToken;

  
Server with which you can exchange an assertion for an access token.
 
   private String authorizationServerUrl;

  
Scope(s) for which this credential provides access.
 
   private String scope;

  
Audience to be used in the json web token. For Google services this is always the authorizationServerUrl.
 
   private String audience;
 
Create an instance of this class. This will only set up on the object, and a call to postConstruct(com.google.api.client.http.HttpTransport,com.google.api.client.json.JsonFactory) is required before it can be used.

Parameters:
applicationName Primary key for this data object in the data store. It is usually the robot name.
authorizationServerUrl Server with which we can exchange an assertion for an access token.
scope Scope(s) for which this credential will request access.
audience Audience to be used in the JSON web token.
 
       String applicationNameString authorizationServerUrlString scopeString audience) {
    this. = applicationName;
    this. = authorizationServerUrl;
    this. = scope;
    this. = audience;
  }

  
Set the access token to a new value.

Parameters:
accessToken New access token or null for none
  public void setAccessToken(String accessToken) {
    this. = accessToken;
  }

  
Finish building the object. This should be called whether the object is loaded using JDO or created using the constructor.

Parameters:
transport com.google.api.client.http.HttpTransport instance to use to access the network.
jsonFactory com.google.api.client.json.JsonFactory instance to use to serialize and deserialize auth server communications.
Throws:
java.io.IOException Thrown when we are unable to set up access token communications.
  public void postConstruct(HttpTransport transportJsonFactory jsonFactorythrows IOException {
        ,
        transport,
        jsonFactory,
        ,
        ,
        ) {
      @Override
      protected void onAccessToken(String accessToken) {
        AppAssertionCredential.this.setAccessToken(accessToken);
      }
    };
  }
  public void initialize(HttpRequest requestthrows IOException {
  }
  public void intercept(HttpRequest requestthrows IOException {
    .intercept(request);
  }
  public boolean handleResponse(HttpRequest requestHttpResponse responseboolean retrySupported)
      throws IOException {
    return .handleResponse(requestresponseretrySupported);
  }
  private void checkIntializationStatus() {
    Preconditions.checkNotNull("Please call postConstruct before using.");
  }
  public boolean isInvalid() {
    return  == null;
  }
New to GrepCode? Check out our FAQ X