Exemple #1
0
 public ManageController(
     UserManager <User> userManager,
     SignInManager <User> signInManager,
     IEmailSender emailSender,
     ISmsSender smsSender,
     ILoggerFactory loggerFactory,
     WarblerDbContext context,
     SamlConfigurations samlConfigurations)
 {
     _userManager        = userManager;
     _signInManager      = signInManager;
     _emailSender        = emailSender;
     _smsSender          = smsSender;
     _logger             = loggerFactory.CreateLogger <ManageController>();
     _dbContext          = context;
     _samlConfigurations = samlConfigurations;
 }
 // Demonstrates loading SAML configuration programmatically
 // rather than through appsettings.json or another JSON configuration file.
 // This is useful if configuration is stored in a custom database, for example.
 // The SAML configuration is registered in ConfigureServices by calling:
 // services.Configure<SamlConfigurations>(config => ConfigureSaml(config));
 private void ConfigureSaml(SamlConfigurations samlConfigurations)
 {
     samlConfigurations.Configurations = new List <SamlConfiguration>()
     {
         new SamlConfiguration()
         {
             ID = "Default",
             LocalIdentityProviderConfiguration = new LocalIdentityProviderConfiguration()
             {
                 Name                   = "https://ExampleIdentityProvider",
                 Description            = "Example Identity Provider",
                 SingleSignOnServiceUrl = "https://localhost:44313/SAML/SingleSignOnService",
                 LocalCertificates      = new List <Certificate>()
                 {
                     new Certificate()
                     {
                         FileName = "certificates/idp.pfx",
                         Password = "******"
                     }
                 }
             },
             PartnerServiceProviderConfigurations = new List <PartnerServiceProviderConfiguration>()
             {
                 new PartnerServiceProviderConfiguration()
                 {
                     Name                        = "https://ExampleServiceProvider",
                     Description                 = "Example Service Provider",
                     WantAuthnRequestSigned      = true,
                     SignSamlResponse            = true,
                     AssertionConsumerServiceUrl = "https://localhost:44360/SAML/AssertionConsumerService",
                     SingleLogoutServiceUrl      = "https://localhost:44360/SAML/SLOService",
                     PartnerCertificates         = new List <Certificate>()
                     {
                         new Certificate()
                         {
                             FileName = "certificates/sp.cer"
                         }
                     }
                 }
             }
         }
     };
 }
Exemple #3
0
        private static void ConfigureSaml(SamlConfigurations samlConfigurations)
        {
            samlConfigurations.Configurations = new List <SamlConfiguration>
            {
                new SamlConfiguration
                {
                    ID = "Default",
                    LocalServiceProviderConfiguration = new LocalServiceProviderConfiguration
                    {
#if DEBUG
                        Name        = "https://localhost:44395",
                        Description = "Warbler Development",
                        AssertionConsumerServiceUrl = "https://localhost:44395/SAML/AssertionConsumerService"
#else
                        Name        = "https://warblerapp.azurewebsites.net",
                        Description = "Warbler Production",
                        AssertionConsumerServiceUrl = "https://warblerapp.azurewebsites.net/SAML/AssertionConsumerService"
#endif
                    }
                }
            };
        }
Exemple #4
0
 public AuthConfigService(IAuthConfigRepository repository, SamlConfigurations configs)
 {
     Repository    = repository;
     LoadedConfigs = configs;
 }
Exemple #5
0
 private void ConfigureDigiD(SamlConfigurations samlConfig)
 {
     Configuration.Bind("SAML", samlConfig);
 }