示例#1
0
        /// <summary>
        /// Initializes an instance of <see cref="Saml2Subject"/> from a <see cref="Saml2SubjectConfirmation"/>.
        /// </summary>
        /// <param name="subjectConfirmation">The <see cref="Saml2SubjectConfirmation"/> to use for initialization.</param>
        public Saml2Subject(Saml2SubjectConfirmation subjectConfirmation)
        {
            if (subjectConfirmation == null)
            {
                throw LogArgumentNullException(nameof(subjectConfirmation));
            }

            _subjectConfirmations.Add(subjectConfirmation);
        }
示例#2
0
        static Saml2SubjectConfirmationData GetBearerSubjectConfirmationData(this Saml2SecurityToken token)
        {
            var confirmation = token.Assertion.Subject.SubjectConfirmations.FirstOrDefault(c => c.Method == Saml2Constants.ConfirmationMethods.Bearer);

            if (confirmation == null)
            {
                token.Assertion.Subject.SubjectConfirmations.Add(confirmation = new Saml2SubjectConfirmation(Saml2Constants.ConfirmationMethods.Bearer));
            }
            if (confirmation.SubjectConfirmationData == null)
            {
                confirmation.SubjectConfirmationData = new Saml2SubjectConfirmationData();
            }
            return(confirmation.SubjectConfirmationData);
        }