Package com.ibm.sbt.security.credential.store

Examples of com.ibm.sbt.security.credential.store.CredentialStore


        throw new ServletException("Missing OAuth token");
      }
      // Store the new key
      oAuthHandler.setAccessTokenObject(tk);
      if (!context.isCurrentUserAnonymous()) {
        CredentialStore cs = CredentialStoreFactory.getCredentialStore(oAuthHandler.getCredentialStore());
        if (cs != null) {
          // But we store it uniquely if the current user is not anonymous
          cs.store(oAuthHandler.getServiceName(), OAuth1Handler.ACCESS_TOKEN_STORE_TYPE, context.getCurrentUserId(), tk);
        }
      } else {
        AnonymousCredentialStore.storeCredentials(context, tk,
            oAuthHandler.getAppId(), oAuthHandler.getServiceName());
      }
View Full Code Here


      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) {
              credStore.store(oAuthHandler.getServiceName(), OAuth2Handler.ACCESS_TOKEN_STORE_TYPE, context.getCurrentUserId(), token);
              }
            } else {
              // Store the token for anonymous user
              AnonymousCredentialStore.storeCredentials(context, token, oAuthHandler.getAppId(), oAuthHandler.getServiceName());
            }
View Full Code Here

          if(!storeAlreadyTried) {
              synchronized (this) {
              Context context = Context.getUnchecked();
              if (context != null) {
                    UserPassword u = null;
                  CredentialStore cs = CredentialStoreFactory.getCredentialStore(getCredentialStore());
                  if(cs!=null) {
                      u = (UserPassword)cs.load(getUrl(),STORE_TYPE,context.getCurrentUserId());
                  }
                    if(u!=null) {
                        this.user = u.getUser();
                        this.password = u.getPassword();
                        return true;
View Full Code Here

    public boolean writeToStore() throws AuthenticationException {
      try {
        Context context = Context.getUnchecked();
        if (context != null) {
          CredentialStore cs = CredentialStoreFactory.getCredentialStore(getCredentialStore());
            if(cs!=null) {
              UserPassword u = new UserPassword(user,password);
                cs.store(getUrl(), STORE_TYPE, context.getCurrentUserId(), u);
                return true;
            }
        }
          return false;
      } catch(CredentialStoreException ex) {
View Full Code Here

    public boolean clearFromStore() throws AuthenticationException {
      try {
        Context context = Context.getUnchecked();
        if (context != null) {
          CredentialStore cs = CredentialStoreFactory.getCredentialStore(getCredentialStore());
            if(cs!=null) {
                cs.remove(getUrl(), STORE_TYPE, context.getCurrentUserId());
                return true;
            }
        }
          return false;
    } catch(CredentialStoreException ex) {
View Full Code Here

TOP

Related Classes of com.ibm.sbt.security.credential.store.CredentialStore

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.