Esempio n. 1
0
        /// <summary>
        /// Loads the token list.
        /// </summary>
        /// <param name="tokenConfigurationSection">The token configuration section.</param>
        /// <returns>Dictionary&lt;System.String, ApiTokenModel&gt;.</returns>
        private static Dictionary <string, JwtTokenModel> LoadTokenList(TokenConfigurationSection tokenConfigurationSection)
        {
            var tokens = new Dictionary <string, JwtTokenModel>();

            for (var i = 0; i < tokenConfigurationSection.Members.Count; i++)
            {
                var definition = tokenConfigurationSection.Members[i].Definition;
                var tokenName  = tokenConfigurationSection.Members[i].Name;

                if (definition?.Signature == null || tokens.ContainsKey(tokenName))
                {
                    continue;
                }

                tokens.Add(tokenName, new JwtTokenModel(tokenName, definition));
            }

            return(tokens);
        }
Esempio n. 2
0
 public TokenConfiguration(TokenConfigurationSection tokenConfigurationSection)
 {
     _tokenConfigurationSection = tokenConfigurationSection;
 }