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

[WIP] IdentityModel dependency update for OpenIdConnect, WsFed, and Bearer #21

Merged
merged 1 commit into from
Aug 9, 2017

Conversation

Tratcher
Copy link
Member

#7 Do not merge.
This is an experiment on what it would take to update Katana to IdetityModel v5. I only did OpenIdConnect for now.

Other packages that need updating:

  • Security.WsFederation - Missing IdentityModel dependencies
  • Security.Jwt - Metadata retrieval needs refactoring, and our only implementations are for WsFed.
  • Security.ActiveDirectory - Depends on WsFed and Security.Jwt

Q:

  1. Are these the right changes to make for OIDC?
  2. Should we check this in and ship alpha1 without the other three? Or ship alpha1 without it? Or just wait?

@Tratcher Tratcher self-assigned this Feb 13, 2017
@ProVega
Copy link

ProVega commented Mar 16, 2017

Looking forward to this... a number of packages in our app have moved to 5.x and we can't build our our Azure AD integration without this update.

@Tratcher Tratcher force-pushed the tratcher/identitymodel branch from 2c1734e to 3048975 Compare June 9, 2017 21:35
@Tratcher
Copy link
Member Author

Tratcher commented Jun 9, 2017

Updated with WsFed and Jwt

@Tratcher
Copy link
Member Author

Compare with dev...lovemaths:5.2.0 for additional changes around tokens vs keys.

@Tratcher Tratcher force-pushed the tratcher/identitymodel branch from 3048975 to bd7e480 Compare August 1, 2017 16:23
@Tratcher
Copy link
Member Author

Tratcher commented Aug 1, 2017

@lovemaths @brentschmaltz I've incorporated your recommendations. Please review.

@Tratcher Tratcher added this to the 4.0.0-alpha1 milestone Aug 1, 2017
@lovemaths
Copy link

@Tratcher The change looks good to me.

@@ -19,6 +19,6 @@ internal class IssuerSigningKeys
/// <summary>
/// Signing tokens.
/// </summary>
public IEnumerable<X509SecurityToken> Tokens { get; set; }
public IEnumerable<SecurityKey> Keys { get; set; }
Copy link

Choose a reason for hiding this comment

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

@Tratcher my apologizes. This is one of the best commits I've ever read. But I can't find any reference/article for migration from System.IdentityModel to Microsoft.IdentityModel Could you please provide us more information about this? We've exciting code that needs to migrated

Copy link
Member Author

Choose a reason for hiding this comment

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

You should take that up with @lovemaths and @brentschmaltz, most of this was done on their advice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@Tratcher Tratcher changed the title [WIP] IdentityModel dependency update for OpenIdConnect [WIP] IdentityModel dependency update for OpenIdConnect, WsFed, and Bearer Aug 8, 2017
{
issuer = entityDescriptor.EntityId.Id;
}
var serializer = new WsFederationMetadataSerializer();
Copy link
Contributor

Choose a reason for hiding this comment

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

nicely simplified :-)

@@ -254,6 +240,11 @@ public string SignInAsAuthenticationType
public ISecureDataFormat<AuthenticationProperties> StateDataFormat { get; set; }

/// <summary>
/// Gets or sets the <see cref="ISecurityTokenValidator"/> used to validate identity tokens.
/// </summary>
public ISecurityTokenValidator SecurityTokenValidator { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

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

Should not be able to set this to null.

using Microsoft.IdentityModel.Protocols;
using Microsoft.IdentityModel.Protocols.OpenIdConnect;
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need the using Microsoft.IdentityModel.Protocols above?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, ConfigurationManager.

}

// what to do here?
if (principal == null)
Copy link
Contributor

Choose a reason for hiding this comment

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

it could be the case the validator returned null OR no validator could read the token.
I agree in either case, you need to throw.

Options.SecurityTokenHandlers = new Collection<ISecurityTokenValidator>
{
new Saml2SecurityTokenHandler(),
// new SamlSecurityTokenHandler(),
Copy link
Contributor

Choose a reason for hiding this comment

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

SamlSecurityTokenHandler is now available.

@Tratcher Tratcher force-pushed the tratcher/identitymodel branch from c818f25 to 99b749c Compare August 9, 2017 18:47
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.

5 participants