Exemple #1
0
 public static FederationMetadataGenerator FromSerializedRelyingParty(PortableRelyingParty portableRelyingParty)
 {
     if (IsSamlRp(portableRelyingParty))
     {
         return(new SamlFederationMetadataGenerator(portableRelyingParty));
     }
     return(new WsFedFederationmetadataGenerator(portableRelyingParty));
 }
Exemple #2
0
        public static PortableRelyingParty FromRelyingPartyTrust(RelyingPartyTrust relyingPartyTrust)
        {
            var source = relyingPartyTrust;
            var target = new PortableRelyingParty();

            target.AutoUpdateEnabled            = source.AutoUpdateEnabled;
            target.ClaimsAccepted               = (source.ClaimsAccepted ?? new ClaimDescription[0]).Select(SerializableClaimDescription.FromClaimDescription).ToList();
            target.ConflictWithPublishedPolicy  = source.ConflictWithPublishedPolicy;
            target.DelegationAuthorizationRules = source.DelegationAuthorizationRules;
            target.Enabled                 = source.Enabled;
            target.EncryptClaims           = source.EncryptClaims;
            target.EncryptedNameIdRequired = source.EncryptedNameIdRequired;
            target.EncryptionCertificate   = source.EncryptionCertificate;
            target.EncryptionCertificateRevocationCheck = source.EncryptionCertificateRevocationCheck;
            target.Identifier = source.Identifier;
            target.ImpersonationAuthorizationRules = source.ImpersonationAuthorizationRules;
            target.IssuanceAuthorizationRules      = source.IssuanceAuthorizationRules;
            target.IssuanceTransformRules          = source.IssuanceTransformRules;
            target.LastMonitoredTime = source.LastMonitoredTime;
            target.LastPublishedPolicyCheckSuccessful = source.LastPublishedPolicyCheckSuccessful;
            target.LastUpdateTime    = source.LastUpdateTime;
            target.MetadataUrl       = source.MetadataUrl;
            target.MonitoringEnabled = source.MonitoringEnabled;
            target.Name                              = source.Name;
            target.NotBeforeSkew                     = source.NotBeforeSkew;
            target.Notes                             = source.Notes;
            target.OrganizationInfo                  = source.OrganizationInfo;
            target.ProtocolProfile                   = source.ProtocolProfile;
            target.RequestSigningCertificate         = (source.RequestSigningCertificate ?? new ReadOnlyCollection <X509Certificate2>(new X509Certificate2[0])).ToArray();
            target.SamlEndpoints                     = (source.SamlEndpoints ?? new SamlEndpoint[0]).Select(SerializableSamlEndpoint.FromSamlEndpoint).ToList();
            target.SamlResponseSignature             = source.SamlResponseSignature;
            target.SignatureAlgorithm                = source.SignatureAlgorithm;
            target.SignedSamlRequestsRequired        = source.SignedSamlRequestsRequired;
            target.SigningCertificateRevocationCheck = source.SigningCertificateRevocationCheck;
            target.TokenLifetime                     = source.TokenLifetime;
            target.WSFedEndpoint                     = source.WSFedEndpoint;

            return(target);
        }
 public SamlFederationMetadataGenerator(PortableRelyingParty portableRelyingParty) : base(portableRelyingParty)
 {
 }
Exemple #4
0
 public WsFedFederationmetadataGenerator(PortableRelyingParty portableRelyingParty) : base(portableRelyingParty)
 {
 }
Exemple #5
0
 private static bool IsSamlRp(PortableRelyingParty portableRelyingParty)
 {
     return(portableRelyingParty.SamlEndpoints.Any());
 }
Exemple #6
0
 protected FederationMetadataGenerator(PortableRelyingParty portableRelyingParty)
 {
     PortableRelyingParty = portableRelyingParty;
 }