Esempio n. 1
0
 public void Add(SecurityTokenType type, string signingKey, string issuer = null, string audience = null, HttpContext context = null)
 {
     this.context = context;
     if (!container.ContainsKey(type.ToString()))
     {
         Tuple <string, string, string> tuple = new Tuple <string, string, string>(signingKey, issuer, audience);
         container.Add(type.ToString(), tuple);
     }
 }
Esempio n. 2
0
        public bool Authenticate(SecurityTokenType type, string token)
        {
            if (container.ContainsKey(SecurityTokenType.NONE.ToString()) && type == SecurityTokenType.NONE)
            {
                return true;
            }

            if (token != null && container.ContainsKey(type.ToString()))
            {
                Tuple<string, string, string> tuple = container[type.ToString()];
                return SecurityTokenValidator.Validate(token, type, tuple.Item1, tuple.Item2, tuple.Item3, context);
            }

            return false;
        }
Esempio n. 3
0
        private string GetCoapUriString(string scheme, string resourceUriString)
        {
            if (!usedToken && securityToken != null &&
                (tokenType != SecurityTokenType.NONE || tokenType != SecurityTokenType.X509))
            {
                usedToken = true;
                return(string.Format("{0}://{1}?r={2}&tt={3}&t={4}", scheme, config.Authority, resourceUriString,
                                     tokenType.ToString(), securityToken));
            }

            return(string.Format("{0}://{1}?r={2}", scheme, config.Authority, resourceUriString));
        }
Esempio n. 4
0
 public bool Remove(SecurityTokenType type)
 {
     return(container.Remove(type.ToString()));
 }