Ejemplo n.º 1
0
        /// <summary>
        /// Returns an instance of the class with meaningful default values set.
        /// </summary>
        /// <returns></returns>
        public static Saml20AuthnRequest GetDefault(string issuer)
        {
            Saml20AuthnRequest result = new Saml20AuthnRequest();
			result.Issuer = issuer;

            List<ConditionAbstract> audienceRestrictions = new List<ConditionAbstract>(1);

            AudienceRestriction audienceRestriction = new AudienceRestriction();
            audienceRestriction.Audience = new List<string>(1);
            audienceRestriction.Audience.Add(issuer);
            audienceRestrictions.Add(audienceRestriction);

            result.SetConditions(audienceRestrictions);

            return result;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns an instance of the class with meaningful default values set.
        /// </summary>
        /// <returns></returns>
        public static Saml20AuthnRequest GetDefault()
        {
            SAML20FederationConfig config = SAML20FederationConfig.GetConfig();

            if (config.ServiceProvider == null || string.IsNullOrEmpty(config.ServiceProvider.ID))
                throw new Saml20FormatException(Resources.ServiceProviderNotSet);

            Saml20AuthnRequest result = new Saml20AuthnRequest();
            result.Issuer = config.ServiceProvider.ID;

            List<ConditionAbstract> audienceRestrictions = new List<ConditionAbstract>(1);

            AudienceRestriction audienceRestriction = new AudienceRestriction();
            audienceRestriction.Audience = new List<string>(1);
            audienceRestriction.Audience.Add(config.ServiceProvider.ID);
            audienceRestrictions.Add(audienceRestriction);

            result.SetConditions(audienceRestrictions);

            return result;
        }