Package com.ibm.sbt.security.authentication.oauth.consumer

Examples of com.ibm.sbt.security.authentication.oauth.consumer.AccessToken


    }
   
    @Override
  public AccessToken loadAccessToken(String appId, String serviceName, String consumerKey, String moduleId, String tokenName, String userId) throws OAuthException {
      String key = getUserKey( appId, serviceName, consumerKey, moduleId, tokenName, userId );
        AccessToken tk = userTokens.get(key);
        if(tk==null) {
          tk = createDefaultAccessToken(appId, serviceName, consumerKey, moduleId, tokenName, userId);
        }
        return tk;
    }
View Full Code Here


    @Override
    protected AccessToken createDefaultAccessToken(String appId, String serviceName, String consumerKey, String moduleId, String tokenName, String userId) throws OAuthException {
      Date expiresIn = new Date(System.currentTimeMillis()+10*24*60*60*1000); // 10 days...
      Date authorizationExpiresIn = new Date(System.currentTimeMillis()+10*24*60*60*1000); // 10 days...
      String sessionHandle = ""; // None...
      return new AccessToken(appId, serviceName, consumerKey, getAccessKey(), getAccessSecret(), userId, expiresIn, authorizationExpiresIn, sessionHandle);
    }
View Full Code Here

      String oauth_verifier = (String) context.getRequestParameterMap().get(OAConstants.OAUTH_VERIFIER);
     
      oAuthHandler.setAccessToken(oauth_token);
      oAuthHandler.setVerifierCode(oauth_verifier);
     
      AccessToken tk = oAuthHandler.readToken(oauth_token, oauth_verifier);
      if (tk == null) {
        // should not happen
        throw new ServletException("Missing OAuth token");
      }
      // Store the new key
View Full Code Here

   
    String authcode = extractAuthorizationToken(request);
    oAuthHandler.setAuthorization_code(authcode);
    try {
      oAuthHandler.getAccessTokenForAuthorizedUser(); // This retrieves and sets all authentication information in OAuth2Handler
      AccessToken token = oAuthHandler.createToken(oAuthHandler.getAppId(),oAuthHandler.getServiceName());
            // Store the new key
      oAuthHandler.setAccessTokenObject(token);
          if(!context.isCurrentUserAnonymous()) {
            CredentialStore credStore = CredentialStoreFactory.getCredentialStore(oAuthHandler.getCredentialStore());
            if(credStore!=null) {
View Full Code Here

  }

  @Override
  public void initialize(DefaultHttpClient httpClient) throws ClientServicesException {
    try {
      AccessToken token = oAuthHandler.acquireToken(false);
      if ((token != null) && (oAuthHandler != null)) {
        HttpRequestInterceptor oauthInterceptor = new OAuthInterceptor(token, super.getUrl(),oAuthHandler);
        httpClient.addRequestInterceptor(oauthInterceptor, 0);
      }
    } catch (OAuthException ex) {
View Full Code Here

  /**
   * This gets called from Basic Proxy and decorates the HttpClient object with required security headers for OAuth2.0 implementation.
   */
  public void initialize(DefaultHttpClient httpClient) throws ClientServicesException {
    try {
      AccessToken accesstoken = oAuthHandler.acquireToken(false);
      if (accesstoken != null) {
        HttpRequestInterceptor oauthInterceptor = new OAuth2Interceptor(accesstoken);
        httpClient.addRequestInterceptor(oauthInterceptor, 0);
      }
    } catch (OAuthException e) {}
View Full Code Here

TOP

Related Classes of com.ibm.sbt.security.authentication.oauth.consumer.AccessToken

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.