Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An Alternative (Simpler) Initialization #59

Closed
jamesmh opened this issue Jan 17, 2019 · 7 comments
Closed

An Alternative (Simpler) Initialization #59

jamesmh opened this issue Jan 17, 2019 · 7 comments

Comments

@jamesmh
Copy link

jamesmh commented Jan 17, 2019

The quick start docs for .NET Core have a code snippet for the initial Okta middleware setup to be used in the ConfigureServices method.

(This one 👇)

services.AddAuthentication(options =>
{
    options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
    options.DefaultChallengeScheme = OktaDefaults.MvcAuthenticationScheme;
})
.AddCookie()
.AddOktaMvc(new OktaMvcOptions
{
    OktaDomain = "https://{yourOktaDomain}",
    ClientId = "{clientId}",
    ClientSecret = "{clientSecret}"
});

// ... the rest of ConfigureServices
services.AddMvc();

This is pretty simple 😊

I just want to throw out an alternative option for devs who:

  • Want to test out the middleware a bit more quickly
  • Don't need any additional customization

It might look something like this (whatever the name might be):

services.AddOktaCookieAuth(configuration);

This would internally do what the above snippet does.

It would reduce the using statements from 2 to 1 - removing the need for:

using Microsoft.AspNetCore.Authentication.Cookies;

It's not a big deal but it's a tiny "win." And tiny "wins" over time can compound, right?

This would match some of the conventions built into .NET Core too. For example, adding the entire MVC infrastructure is simply:

services.AddMvc();

Under the covers that would add a bunch of stuff that the dev could otherwise add himself. But the simple convenience is part of what makes .NET Core so great.

Other pros:

  • Could lead to simplifying the "quick start" docs a tiny bit
  • Help make demos etc. a bit quicker to get started

If you guys think this is a good idea I'd be up for implementing that. Otherwise, no harm done 🤣

Thanks! Keep up the good work guys 👌

@laura-rodriguez
Copy link
Collaborator

Hi @jamesmh,

Thanks for your feedback ❤️! It sounds like a good idea.
I'll discuss this feature with the team and I'll get back to you soon.

@jamesmh
Copy link
Author

jamesmh commented Jan 23, 2019

Great - thank you so much @laura-rodriguez !

@laura-rodriguez
Copy link
Collaborator

Hi @jamesmh!
We all agreed this is a good idea 😄 . Are you still up to implement this?

@jamesmh
Copy link
Author

jamesmh commented Feb 1, 2019

Yes I am 👍

I'll ask any questions etc. on this thread - I'm sure I'll have a few 😋

Thanks Laura!

@laura-rodriguez
Copy link
Collaborator

You will have to sign our Okta Individual Contributor License Agreement. All the info you need is here: https://developer.okta.com/cla/

@jamesmh
Copy link
Author

jamesmh commented Feb 6, 2019

I'll sign that off soon 👍

Question: In order to test the new extension method properly, it looks like I'll have to create a new integration test project - is that OK with you guys?

@laura-rodriguez
Copy link
Collaborator

laura-rodriguez commented Feb 6, 2019

Hi @jamesmh,
Integration tests are welcome! We already have some projects created for this purpose (look for those with IntegrationTests suffix 😄), feel free to add your tests in there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants