diff options
author | David Christiansen <DavidChristiansen@users.noreply.github.com> | 2015-01-05 21:31:54 +0000 |
---|---|---|
committer | David Christiansen <DavidChristiansen@users.noreply.github.com> | 2015-01-05 21:31:54 +0000 |
commit | b0f5f21523526c863b9a61f64864109d96738c9b (patch) | |
tree | b082a01743f2d20ce80dddcc4a99f88f0c49e1c4 /samples/DotNetOpenAuth.Samples.OpenIDConnectRP/Models/IdentityModels.cs | |
parent | f840b593c345265ebcfd6c1cf5b57ab6d948f92c (diff) | |
parent | 5fde84cfe2967d203c8bc183708394d95bb52c36 (diff) | |
download | DotNetOpenAuth-b0f5f21523526c863b9a61f64864109d96738c9b.zip DotNetOpenAuth-b0f5f21523526c863b9a61f64864109d96738c9b.tar.gz DotNetOpenAuth-b0f5f21523526c863b9a61f64864109d96738c9b.tar.bz2 |
Merge pull request #368 from DavidChristiansen/develop
Straight forward OpenID Connect RP example
Diffstat (limited to 'samples/DotNetOpenAuth.Samples.OpenIDConnectRP/Models/IdentityModels.cs')
-rw-r--r-- | samples/DotNetOpenAuth.Samples.OpenIDConnectRP/Models/IdentityModels.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/Models/IdentityModels.cs b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/Models/IdentityModels.cs new file mode 100644 index 0000000..12bd3dc --- /dev/null +++ b/samples/DotNetOpenAuth.Samples.OpenIDConnectRP/Models/IdentityModels.cs @@ -0,0 +1,33 @@ +using System.Data.Entity; +using System.Security.Claims; +using System.Threading.Tasks; +using Microsoft.AspNet.Identity; +using Microsoft.AspNet.Identity.EntityFramework; + +namespace DotNetOpenAuth.Samples.OpenIDConnectRP.Models +{ + // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more. + public class ApplicationUser : IdentityUser + { + public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager) + { + // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType + var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie); + // Add custom user claims here + return userIdentity; + } + } + + public class ApplicationDbContext : IdentityDbContext<ApplicationUser> + { + public ApplicationDbContext() + : base("DefaultConnection", throwIfV1Schema: false) + { + } + + public static ApplicationDbContext Create() + { + return new ApplicationDbContext(); + } + } +}
\ No newline at end of file |