Exemple #1
0
        /// <summary>
        /// Creates a <see cref="ClaimsIdentity"/> from the Saml2 token.
        /// </summary>
        /// <param name="samlToken">The Saml2SecurityToken.</param>
        /// <param name="issuer">The issuer value for each <see cref="Claim"/> in the <see cref="ClaimsIdentity"/>.</param>
        /// <param name="validationParameters"> Contains parameters for validating the token.</param>
        /// <returns>An IClaimIdentity.</returns>
        protected virtual ClaimsIdentity CreateClaimsIdentity(Saml2SecurityToken samlToken, string issuer, TokenValidationParameters validationParameters)
        {
            if (samlToken == null)
            {
                throw new ArgumentNullException("samlToken");
            }

            if (validationParameters == null)
            {
                throw new ArgumentNullException("validationParameters");
            }

            if (string.IsNullOrWhiteSpace(issuer))
            {
                throw new ArgumentException(LogMessages.IDX10221);
            }

            throw new NotImplementedException();
        }
Exemple #2
0
        /// <summary>
        /// Serializes to XML a token of the type handled by this instance.
        /// </summary>
        /// <param name="writer">The XML writer.</param>
        /// <param name="token">A token of type <see cref="TokenType"/>.</param>
        public override void WriteToken(XmlWriter writer, SecurityToken token)
        {
            if (writer == null)
            {
                throw LogHelper.LogArgumentNullException("writer");
            }

            if (token == null)
            {
                throw LogHelper.LogArgumentNullException("token");
            }

            Saml2SecurityToken samlSecurityToken = token as Saml2SecurityToken;

            if (samlSecurityToken == null)
            {
                throw LogHelper.LogExceptionMessage(new ArgumentException(String.Format(CultureInfo.InvariantCulture, LogMessages.IDX10400, GetType(), typeof(SamlSecurityToken), token.GetType())));
            }

            throw new NotSupportedException();
        }
Exemple #3
0
        /// <summary>
        /// Serializes to <see cref="Saml2SecurityToken"/> to a string.
        /// </summary>
        /// <param name="token">A <see cref="Saml2SecurityToken"/>.</param>
        public override string WriteToken(SecurityToken token)
        {
            if (token == null)
            {
                throw LogHelper.LogArgumentNullException("token");
            }

            Saml2SecurityToken samlSecurityToken = token as Saml2SecurityToken;

            if (samlSecurityToken == null)
            {
                throw LogHelper.LogExceptionMessage(new ArgumentException(String.Format(CultureInfo.InvariantCulture, LogMessages.IDX10400, this.GetType(), typeof(Saml2SecurityToken), token.GetType())));
            }

            StringBuilder stringBuilder = new StringBuilder();

            using (XmlWriter xmlWriter = XmlWriter.Create(stringBuilder))
            {
                throw new NotSupportedException();
            }
        }
        /// <summary>
        /// Serializes to XML a token of the type handled by this instance.
        /// </summary>
        /// <param name="writer">The XML writer.</param>
        /// <param name="token">A token of type <see cref="TokenType"/>.</param>
        public override void WriteToken(XmlWriter writer, SecurityToken token)
        {
            if (writer == null)
            {
                throw LogHelper.LogArgumentNullException("writer");
            }

            if (token == null)
            {
                throw LogHelper.LogArgumentNullException("token");
            }

            Saml2SecurityToken samlSecurityToken = token as Saml2SecurityToken;

            if (samlSecurityToken == null)
            {
                throw LogHelper.LogException <ArgumentException>(LogMessages.IDX10400, GetType(), typeof(SamlSecurityToken), token.GetType());
            }

            throw new NotSupportedException();
        }