public static EntitiesDescriptor GetEntitiesDescriptor() { var descriptor = new EntitiesDescriptor(); var entityDesc = EntityDescriptorProviderMock.GetEntityDescriptor(); descriptor.ChildEntities.Add(entityDesc); return(descriptor); }
public static EntityDescriptor GetSpEntityDescriptor(string entityId) { var descriptor = new EntityDescriptor(new EntityId(entityId)); var cert = EntityDescriptorProviderMock.GetMockCertificate(); var idpRole = new ServiceProviderSingleSignOnDescriptor(); idpRole.AssertionConsumerServices.Add(0, new IndexedProtocolEndpoint(0, new Uri(ProtocolBindings.HttpRedirect), new Uri("http://localhost:60879"))); descriptor.RoleDescriptors.Add(idpRole); return(descriptor); }
public static EntityDescriptor GetEntityDescriptor() { var descriptor = new EntityDescriptor(); var cert = EntityDescriptorProviderMock.GetMockCertificate(); var idpRole = new IdentityProviderSingleSignOnDescriptor(); idpRole.SingleSignOnServices.Add(new ProtocolEndpoint(new Uri(ProtocolBindings.HttpRedirect), new Uri("http://localhost:60879"))); descriptor.RoleDescriptors.Add(idpRole); return(descriptor); }
public static EntityDescriptor GetIdpEntityDescriptor(string entityId) { var descriptor = new EntityDescriptor(new EntityId(entityId)); var cert = EntityDescriptorProviderMock.GetMockCertificate(); var idpRole = new IdentityProviderSingleSignOnDescriptor(); idpRole.ProtocolsSupported.Add(new Uri("urn:oasis:names:tc:SAML:2.0:protocol")); idpRole.SingleSignOnServices.Add(new ProtocolEndpoint(new Uri(ProtocolBindings.HttpRedirect), new Uri("http://localhost:60879"))); descriptor.RoleDescriptors.Add(idpRole); return(descriptor); }
public static EntitiesDescriptor GetEntitiesDescriptor(int idpEntities, int spEntities) { var descriptor = new EntitiesDescriptor(); for (var i = 0; i < idpEntities; i++) { var entityDesc = EntityDescriptorProviderMock.GetIdpEntityDescriptor(String.Format("IdpEntityId_{0}", i)); descriptor.ChildEntities.Add(entityDesc); } for (var i = 0; i < spEntities; i++) { var entityDesc = EntityDescriptorProviderMock.GetSpEntityDescriptor(String.Format("SPEntityId_{0}", i)); descriptor.ChildEntities.Add(entityDesc); } return(descriptor); }
public override async Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { var entity = EntityDescriptorProviderMock.GetIdpEntityDescriptor("IdpEntity"); var serialiser = new MetadataSerializer(); var sb = new StringBuilder(); using (var writer = XmlWriter.Create(sb)) { serialiser.WriteMetadata(writer, entity); writer.Flush(); HttpClientMock.Metadata = sb.ToString(); var content = new StreamContent(new MemoryStream(Encoding.UTF8.GetBytes(HttpClientMock.Metadata))); var message = new HttpResponseMessage(HttpStatusCode.OK) { Content = content }; return(message); } }