Package org.apache.shindig.gadgets.oauth

Examples of org.apache.shindig.gadgets.oauth.BasicOAuthStoreTokenIndex


  }
 
  @Override
  public void setTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo,
      String serviceName, String tokenName, TokenInfo tokenInfo) {
    BasicOAuthStoreTokenIndex tokenKey =
        makeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);
    tokens.put(tokenKey, tokenInfo);
  }
View Full Code Here


  }

  @Override
  public void removeToken(SecurityToken securityToken, ConsumerInfo consumerInfo,
      String serviceName, String tokenName) {
    BasicOAuthStoreTokenIndex tokenKey =
        makeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);
    tokens.remove(tokenKey);
 
View Full Code Here

@PrimaryType(name = "tkn:gadgettoken")
public abstract class GadgetTokenEntry {

    public BasicOAuthStoreTokenIndex getKey() {
        BasicOAuthStoreTokenIndex key = new BasicOAuthStoreTokenIndex();
        key.setGadgetUri(getGadgetUri());
        key.setModuleId(getModuleId());
        key.setServiceName(getServiceName());
        key.setTokenName(getTokenName());
        key.setUserId(getUserId());
        return key;
    }
View Full Code Here

    protected abstract Map<String, GadgetTokenEntry> getGadgetTokens();

    public GadgetToken getToken(BasicOAuthStoreTokenIndex tokenKey) {
        Map<String, GadgetTokenEntry> tokens = getGadgetTokens();
        for (GadgetTokenEntry tokenEntry : tokens.values()) {
            BasicOAuthStoreTokenIndex key = tokenEntry.getKey();
            if (tokenKey.equals(key))
                return tokenEntry.getToken();
        }
        return null;
    }
View Full Code Here

    public GadgetToken removeToken(BasicOAuthStoreTokenIndex tokenKey) {
        Map<String, GadgetTokenEntry> tokens = getGadgetTokens();

        for (GadgetTokenEntry tokenEntry : tokens.values()) {
            BasicOAuthStoreTokenIndex key = tokenEntry.getKey();
            if (tokenKey.equals(key)) {
                GadgetToken token = tokenEntry.getToken();
                tokenEntry.remove();
                return token;
            }
View Full Code Here

    public GadgetToken saveToken(BasicOAuthStoreTokenIndex tokenKey, TokenInfo tokenInfo, long expirationTime) {
        Map<String, GadgetTokenEntry> tokens = getGadgetTokens();
        GadgetTokenEntry entry = null;
        for (GadgetTokenEntry item : tokens.values()) {
            BasicOAuthStoreTokenIndex key = item.getKey();
            if (tokenKey.equals(key)) {
                entry = item;
            }
        }
        if (entry == null) {
View Full Code Here

        return new ConsumerInfo(consumer, cks.getKeyName(), callback);
    }

    private BasicOAuthStoreTokenIndex makeBasicOAuthStoreTokenIndex(SecurityToken securityToken, String serviceName,
            String tokenName) {
        BasicOAuthStoreTokenIndex tokenKey = new BasicOAuthStoreTokenIndex();
        tokenKey.setGadgetUri(securityToken.getAppUrl());

        // TODO: tung.dang need to improve, why moduleId different each time?.
        // tokenKey.setModuleId(securityToken.getModuleId());

        tokenKey.setServiceName(serviceName);
        tokenKey.setTokenName(tokenName);
        tokenKey.setUserId(securityToken.getViewerId());
        return tokenKey;
    }
View Full Code Here

        return tokenKey;
    }

    public TokenInfo getTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName, String tokenName) {
        ++accessTokenLookupCount;
        BasicOAuthStoreTokenIndex tokenKey = makeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);

        ExoContainer container = PortalContainer.getInstance();
        GadgetTokenInfoService tokenSer = (GadgetTokenInfoService) container
                .getComponentInstanceOfType(GadgetTokenInfoService.class);
        return tokenSer.getToken(tokenKey);
View Full Code Here

    }

    public void setTokenInfo(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName, String tokenName,
            TokenInfo tokenInfo) {
        ++accessTokenAddCount;
        BasicOAuthStoreTokenIndex tokenKey = makeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);
        ExoContainer container = PortalContainer.getInstance();
        GadgetTokenInfoService tokenSer = (GadgetTokenInfoService) container
                .getComponentInstanceOfType(GadgetTokenInfoService.class);
        tokenSer.createToken(tokenKey, tokenInfo);
    }
View Full Code Here

        tokenSer.createToken(tokenKey, tokenInfo);
    }

    public void removeToken(SecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName, String tokenName) {
        ++accessTokenRemoveCount;
        BasicOAuthStoreTokenIndex tokenKey = makeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);
        ExoContainer container = PortalContainer.getInstance();
        GadgetTokenInfoService tokenSer = (GadgetTokenInfoService) container
                .getComponentInstanceOfType(GadgetTokenInfoService.class);
        tokenSer.deleteToken(tokenKey);
    }
View Full Code Here

TOP

Related Classes of org.apache.shindig.gadgets.oauth.BasicOAuthStoreTokenIndex

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.