コード例 #1
0
        public static LinkIDAuthnResponse parse(ResponseType response)
        {
            String userId = null;
            Dictionary <String, List <LinkIDAttribute> > attributes = new Dictionary <string, List <LinkIDAttribute> >();

            foreach (object item in response.Items)
            {
                AssertionType assertion = (AssertionType)item;
                SubjectType   subject   = assertion.Subject;
                NameIDType    nameId    = (NameIDType)subject.Items[0];
                userId = nameId.Value;

                foreach (StatementAbstractType statement in assertion.Items)
                {
                    if (statement is AttributeStatementType)
                    {
                        AttributeStatementType attributeStatement = (AttributeStatementType)statement;
                        attributes = getAttributes(attributeStatement);
                    }
                }
            }

            LinkIDPaymentResponse      paymentResponse      = findPaymentResponse(response);
            LinkIDExternalCodeResponse externalCodeResponse = findExternalCodeResponse(response);

            return(new LinkIDAuthnResponse(userId, attributes, paymentResponse, externalCodeResponse));
        }
コード例 #2
0
 public LinkIDAuthnResponse(String userId, Dictionary <String, List <LinkIDAttribute> > attributes,
                            LinkIDPaymentResponse paymentResponse, LinkIDExternalCodeResponse externalCodeResponse)
 {
     this.userId               = userId;
     this.attributes           = attributes;
     this.paymentResponse      = paymentResponse;
     this.externalCodeResponse = externalCodeResponse;
 }
コード例 #3
0
        private static LinkIDExternalCodeResponse findExternalCodeResponse(ResponseType response)
        {
            if (null == response.Extensions || null == response.Extensions.Any)
            {
                return(null);
            }
            if (0 == response.Extensions.Any.Length)
            {
                return(null);
            }

            XmlElement xmlElement = response.Extensions.Any[0];

            if (xmlElement.LocalName.Equals(LinkIDExternalCodeResponse.LOCAL_NAME))
            {
                ExternalCodeResponseType externalCodeResponseType = deserializeExternalCodeResponse(xmlElement);
                return(LinkIDExternalCodeResponse.fromSaml(externalCodeResponseType));
            }

            return(null);
        }