OAuth Api call success

This commit is contained in:
2016-06-13 13:33:32 +02:00
parent 8ce7767672
commit ca4625a7cf
22 changed files with 1510 additions and 1779 deletions

View File

@ -0,0 +1,21 @@
namespace Yavsc.Models.Auth
{
public class Me {
public Me(ApplicationUser user)
{
Id = user.Id;
GivenName = user.UserName;
Emails = new string [] { user.Email } ;
}
public string Id { get; set; }
public string GivenName { get; set; }
public string[] Emails { get; set; }
/// <summary>
/// Known as profile, could point to an avatar
/// </summary>
/// <returns></returns>
public string Url { get; set; }
}
}

View File

@ -108,7 +108,7 @@ public class BlogViewHandler : AuthorizationHandler<ViewRequirement, Blog>
protected override void Handle(AuthorizationContext context, PrivateChatEntryRequirement requirement)
{
if (!context.User.HasClaim(c => c.Type == "TemporaryBadgeExpiry" &&
c.Issuer == Constants.Issuer))
c.Issuer == Startup.Authority))
{
return;
}
@ -116,7 +116,7 @@ public class BlogViewHandler : AuthorizationHandler<ViewRequirement, Blog>
var temporaryBadgeExpiry =
Convert.ToDateTime(context.User.FindFirst(
c => c.Type == "TemporaryBadgeExpiry" &&
c.Issuer == Constants.Issuer).Value);
c.Issuer == Startup.Authority).Value);
if (temporaryBadgeExpiry > DateTime.Now)
{
@ -130,7 +130,7 @@ public class BlogViewHandler : AuthorizationHandler<ViewRequirement, Blog>
protected override void Handle(AuthorizationContext context, PrivateChatEntryRequirement requirement)
{
if (!context.User.HasClaim(c => c.Type == "BadgeNumber" &&
c.Issuer == Constants.Issuer))
c.Issuer == Startup.Authority))
{
return;
}