Sustainsys / Saml2

Saml2 Authentication services for ASP.NET
Other
960 stars 602 forks source link

need help setting OKTA as IDp #383

Closed FarhanaJabbar closed 8 years ago

FarhanaJabbar commented 8 years ago

Hi,

I was trying to follow your instructions mentioned in https://github.com/KentorIT/authservices/blob/master/doc/IdentityServer3Okta.md to setup okta as IDp. The problem i am having is , how i should setup the the Identity server options as you have not provided any details for this here. var options = Helpers.GetIdentityServerOptions();

Could you please help as i am stuck here

Regards,

Farhana

AndersAbel commented 8 years ago

@dahlsailrunner is this anything you can answer?

dahlsailrunner commented 8 years ago

Hi Farhana -

This really comes down to your configuration and requirements for IdentityServer3. The steps in setting something very simple are here: https://identityserver.github.io/Documentation/docsv2/overview/simplestOAuth.html

The complete documentation for the options is here: https://identityserver.github.io/Documentation/docsv2/configuration/identityServerOptions.html

My code for setting these options (which may differ from your requirements) is here (and I'll add some comments to explain certain lines below):

public static IdentityServerOptions GetIdentityServerOptions()
        {
            var options = new IdentityServerOptions
            {
                IssuerUri = GetIssuerUri(),
                RequireSsl = true,
                SiteName = "My Custom Identity",
                EnableWelcomePage = true,
            };

            var factory = new IdentityServerServiceFactory()
                .UseInMemoryClients(Clients.Get())
                .UseInMemoryScopes(Scopes.Get());

            var efConfig = new EntityFrameworkServiceOptions {ConnectionString = "IdSvr3Config." + Config.Instance.EnvCd.ToLower() };
            factory.RegisterOperationalServices(efConfig);

            var userService = new NwpUserService();
            factory.UserService = new Registration<IUserService>(resolver => userService);
            factory.ViewService = new Registration<IViewService>(typeof (NwpViewService));
            //factory.CorsPolicyService = new Registration<ICorsPolicyService>(new DefaultCorsPolicyService { AllowAll = true });
            options.Factory = factory;

            options.SigningCertificate = GetSigningCertificate();

            return options;
        }

Peeling this back almost line by line:

The Identity Server samples are very helpful and can be found here: https://github.com/IdentityServer/IdentityServer3.Samples

Regards - Erik