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

Fixes #3862 Support SDK 1.0 in 2.0 topics #3870

Merged
merged 17 commits into from
Aug 2, 2017
Merged

Fixes #3862 Support SDK 1.0 in 2.0 topics #3870

merged 17 commits into from
Aug 2, 2017

Conversation

01binary
Copy link
Contributor

@01binary 01binary commented Aug 2, 2017

Can we mark off the steps that require ASP.NET Core 2.0? Did we lose the steps for 1.x?
@RickAndMSFT

Added tabbed snippets like on this page:
https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?tabs=aspnet1x

Unfortunately docfx cannot preview the tabs, you will have to look at internal build to verify they are working.


Not sure why it says 17 commits, merging just one. I pulled from this repo before making any changes. If you see anything wrong let me know.

@dnfclas
Copy link

dnfclas commented Aug 2, 2017

@01binary,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@Rick-Anderson
Copy link
Contributor

@scottaddie @tdykstra can you advice how to prevent PR from showing previous commits?
Tabs look good.

@Rick-Anderson
Copy link
Contributor

@tdykstra @scottaddie Is this OK to merge? The file differences are correct and minimal. If it's OK, can one of you merge this? I'm traveling today.

@Rick-Anderson
Copy link
Contributor

Review URL

@Rick-Anderson Rick-Anderson merged commit 88069f5 into dotnet:master Aug 2, 2017
@scottaddie scottaddie self-requested a review August 2, 2017 18:59

```csharp
services.AddFacebookAuthentication(facebookOptions =>
services.AddFacebookAuthentication(new FacebookOptions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2.0 RTM bits change the code to the following:

```csharp
services.AddAuthentication().AddFacebook(o => {
    o.AppId = Configuration["Authentication:Facebook:AppId"];
    o.AppSecret = Configuration["Authentication:Facebook:AppSecret"];
});
```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverting to prev. with named options object for readability


```csharp
services.AddGoogleAuthentication(googleOptions =>
services.AddGoogleAuthentication(new GoogleOptions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2.0 RTM bits change the code to the following:

services.AddAuthentication().AddGoogle(o => {
    o.ClientId = Configuration["Authentication:Google:ClientId"];
    o.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

Add the Microsoft Account middleware in the `ConfigureServices` method in `Startup.cs` file:

```csharp
services.AddMicrosoftAuthentication(new MicrosoftAccountOptions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2.0 RTM bits change the code to the following:

    services.AddAuthentication().AddMicrosoftAccount(o => {
        o.ClientId = Configuration["Authentication:Microsoft:ApplicationId"];
        o.ClientSecret = Configuration["Authentication:Microsoft:Password"];
    });


```csharp
services.AddTwitterAuthentication(twitterOptions =>
services.AddTwitterAuthentication(new TwitterOptions()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 2.0 RTM bits change the code to the following:

    services.AddAuthentication().AddTwitter(o => {
        o.ConsumerKey = Configuration["Authentication:Twitter:ConsumerKey"];
        o.ConsumerSecret = Configuration["Authentication:Twitter:ConsumerSecret"];
    });


Add the Facebook middleware in the `ConfigureServices` method in the *Startup.cs* file:
* To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**.
* To install with **dotnet** CLI, execute the following in your project directory:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet CLI --> .NET Core CLI


# [ASP.NET Core 1.x](#tab/aspnet1x)

Add the Twitter middleware in the `Configure` method in `Startup.cs` file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Italicize Startup.cs


# [ASP.NET Core 2.0](#tab/aspnet20)

Add the Twitter middleware in the `ConfigureServices` method in `Startup.cs` file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Italicize Startup.cs

> See the [MicrosoftOptions](https://github.com/aspnet/Security/blob/dev/src/Microsoft.AspNetCore.Authentication.Microsoft/MicrosoftOptions.cs) class in ASP.NET Core repository for more information on configuration options supported by Microsoft Account middleware. This can be used to request different information about the user.
# [ASP.NET Core 2.0](#tab/aspnet20)

Add the Microsoft Account middleware in the `ConfigureServices` method in `Startup.cs` file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Italicize Startup.cs


# [ASP.NET Core 2.0](#tab/aspnet20)

Add the Google middleware in the `ConfigureServices` method in `Startup.cs` file:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Italicize Startup.cs

@@ -84,25 +84,40 @@ The values for these tokens can be found in the JSON file downloaded in the prev

## Configure Google middleware

Note: The project template used in this tutorial ensures that
[Microsoft.AspNetCore.Authentication.Google](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Google) package is installed.
The project template used in this tutorial ensures that [Microsoft.AspNetCore.Authentication.Google](https://www.nuget.org/packages/Microsoft.AspNetCore.Authentication.Google) package is installed.

* To install this package with Visual Studio 2017, right-click on the project and select **Manage NuGet Packages**.
* To install with **dotnet** CLI, execute the following in your project directory:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet CLI --> .NET Core CLI

@scottaddie
Copy link
Member

@Rick-Anderson We may want to consider reverting the merge. The code snippets are incorrect for 2.0 RTM.

@01binary
Copy link
Contributor Author

01binary commented Aug 2, 2017

I got confused with the signature, it is indeed a function returning XXXOptions. That's what I originally tested with before changing to new XXXOptions()

[EDIT]

Oops, didn't see on my phone that this got merged. We should roll back! Does anyone know how? I can do another PR if needed.

@01binary
Copy link
Contributor Author

01binary commented Aug 3, 2017

Allright, cooking another PR, please don't merge it too soon this time.

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

Successfully merging this pull request may close these issues.

4 participants