Implement UserData and TitleData
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
{
|
||||
public static class AuthClaimTypes
|
||||
{
|
||||
public const string Id = "id";
|
||||
public const string UserId = "user_id";
|
||||
public const string EntityId = "entity_id";
|
||||
public const string Type = "type";
|
||||
}
|
||||
}
|
||||
@@ -38,20 +38,21 @@ namespace Prospect.Server.Api.Services.Auth
|
||||
return _tokenHandler.WriteToken(token);
|
||||
}
|
||||
|
||||
public string Generate(PlayFabUser user)
|
||||
public string GenerateUser(PlayFabEntity user)
|
||||
{
|
||||
return CreateToken(new[]
|
||||
{
|
||||
new Claim(AuthClaimTypes.Id, user.Id),
|
||||
new Claim(AuthClaimTypes.UserId, user.UserId),
|
||||
new Claim(AuthClaimTypes.EntityId, user.Id),
|
||||
new Claim(AuthClaimTypes.Type, AuthType.User),
|
||||
});
|
||||
}
|
||||
|
||||
public string Generate(PlayFabEntity entity)
|
||||
public string GenerateEntity(PlayFabEntity entity)
|
||||
{
|
||||
return CreateToken(new[]
|
||||
{
|
||||
new Claim(AuthClaimTypes.Id, entity.Id),
|
||||
new Claim(AuthClaimTypes.EntityId, entity.Id),
|
||||
new Claim(AuthClaimTypes.Type, AuthType.Entity),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,9 +5,14 @@ namespace Prospect.Server.Api.Services.Auth.Extensions
|
||||
{
|
||||
public static class ClaimsPrincipalExtensions
|
||||
{
|
||||
public static string FindAuthId(this ClaimsPrincipal principal)
|
||||
public static string FindAuthUserId(this ClaimsPrincipal principal)
|
||||
{
|
||||
return Find(principal, AuthClaimTypes.Id);
|
||||
return Find(principal, AuthClaimTypes.UserId);
|
||||
}
|
||||
|
||||
public static string FindAuthEntityId(this ClaimsPrincipal principal)
|
||||
{
|
||||
return Find(principal, AuthClaimTypes.EntityId);
|
||||
}
|
||||
|
||||
public static string FindAuthType(this ClaimsPrincipal principal)
|
||||
|
||||
Reference in New Issue
Block a user