Exemple #1
0
        public override void removeToken(ISecurityToken securityToken, ConsumerInfo consumerInfo, String serviceName, String tokenName)
        {
            ++accessTokenRemoveCount;
            BasicOAuthStoreTokenIndex tokenKey = MakeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);

            tokens.Remove(tokenKey);
        }
Exemple #2
0
        public override void setTokenInfo(ISecurityToken securityToken, ConsumerInfo consumerInfo,
                                          String serviceName, String tokenName, TokenInfo tokenInfo)
        {
            ++accessTokenAddCount;
            BasicOAuthStoreTokenIndex tokenKey = MakeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);

            tokens.Add(tokenKey, tokenInfo);
        }
Exemple #3
0
        public override TokenInfo getTokenInfo(ISecurityToken securityToken, ConsumerInfo consumerInfo,
                                               String serviceName, String tokenName)
        {
            ++accessTokenLookupCount;
            BasicOAuthStoreTokenIndex tokenKey = MakeBasicOAuthStoreTokenIndex(securityToken, serviceName, tokenName);

            return(tokens.ContainsKey(tokenKey)?tokens[tokenKey]:null);
        }
Exemple #4
0
        private static BasicOAuthStoreTokenIndex MakeBasicOAuthStoreTokenIndex(ISecurityToken securityToken, String serviceName, String tokenName)
        {
            BasicOAuthStoreTokenIndex tokenKey = new BasicOAuthStoreTokenIndex();

            tokenKey.setGadgetUri(securityToken.getAppUrl());
            tokenKey.setModuleId(securityToken.getModuleId());
            tokenKey.setServiceName(serviceName);
            tokenKey.setTokenName(tokenName);
            tokenKey.setUserId(securityToken.getViewerId());
            return(tokenKey);
        }
Exemple #5
0
        public override bool Equals(Object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (GetType() != obj.GetType())
            {
                return(false);
            }
            BasicOAuthStoreTokenIndex other = (BasicOAuthStoreTokenIndex)obj;

            if (gadgetUri == null)
            {
                if (other.gadgetUri != null)
                {
                    return(false);
                }
            }
            else if (!gadgetUri.Equals(other.gadgetUri))
            {
                return(false);
            }
            if (moduleId != other.moduleId)
            {
                return(false);
            }
            if (serviceName == null)
            {
                if (other.serviceName != null)
                {
                    return(false);
                }
            }
            else if (!serviceName.Equals(other.serviceName))
            {
                return(false);
            }
            if (tokenName == null)
            {
                if (other.tokenName != null)
                {
                    return(false);
                }
            }
            else if (!tokenName.Equals(other.tokenName))
            {
                return(false);
            }
            if (userId == null)
            {
                if (other.userId != null)
                {
                    return(false);
                }
            }
            else if (!userId.Equals(other.userId))
            {
                return(false);
            }
            return(true);
        }
Exemple #6
0
 private static BasicOAuthStoreTokenIndex MakeBasicOAuthStoreTokenIndex(ISecurityToken securityToken, String serviceName, String tokenName)
 {
     BasicOAuthStoreTokenIndex tokenKey = new BasicOAuthStoreTokenIndex();
     tokenKey.setGadgetUri(securityToken.getAppUrl());
     tokenKey.setModuleId(securityToken.getModuleId());
     tokenKey.setServiceName(serviceName);
     tokenKey.setTokenName(tokenName);
     tokenKey.setUserId(securityToken.getViewerId());
     return tokenKey;
 }