Updating game data to mid season patch and made card gallery nicer
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Security.Claims;
|
||||
using Cloud.Models;
|
||||
using Fido2NetLib;
|
||||
using Fido2NetLib.Objects;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
@@ -6,7 +7,6 @@ using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Cloud.Models;
|
||||
|
||||
namespace Cloud.Controllers;
|
||||
|
||||
@@ -17,9 +17,9 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
private const string RegOptionsKey = "fido2.reg.options";
|
||||
private const string AssertOptionsKey = "fido2.assert.options";
|
||||
private readonly AppDbContext _db;
|
||||
|
||||
private readonly IFido2 _fido2;
|
||||
private readonly AppDbContext _db;
|
||||
|
||||
public AuthController(IFido2 fido2, AppDbContext db)
|
||||
{
|
||||
@@ -55,9 +55,9 @@ public class AuthController : ControllerBase
|
||||
AuthenticatorSelection = new AuthenticatorSelection
|
||||
{
|
||||
ResidentKey = ResidentKeyRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required
|
||||
},
|
||||
AttestationPreference = AttestationConveyancePreference.None,
|
||||
AttestationPreference = AttestationConveyancePreference.None
|
||||
});
|
||||
|
||||
HttpContext.Session.SetString(RegOptionsKey, options.ToJson());
|
||||
@@ -65,7 +65,8 @@ public class AuthController : ControllerBase
|
||||
}
|
||||
|
||||
[HttpPost("register/complete")]
|
||||
public async Task<IActionResult> RegisterComplete([FromBody] AuthenticatorAttestationRawResponse attestationResponse)
|
||||
public async Task<IActionResult> RegisterComplete(
|
||||
[FromBody] AuthenticatorAttestationRawResponse attestationResponse)
|
||||
{
|
||||
var json = HttpContext.Session.GetString(RegOptionsKey);
|
||||
if (json is null) return BadRequest("Session expired. Please retry enrollment.");
|
||||
@@ -84,7 +85,7 @@ public class AuthController : ControllerBase
|
||||
{
|
||||
AttestationResponse = attestationResponse,
|
||||
OriginalOptions = options,
|
||||
IsCredentialIdUniqueToUserCallback = isUnique,
|
||||
IsCredentialIdUniqueToUserCallback = isUnique
|
||||
});
|
||||
|
||||
var credential = new PasskeyCredential
|
||||
@@ -93,7 +94,7 @@ public class AuthController : ControllerBase
|
||||
PublicKey = result.PublicKey,
|
||||
SignCount = result.SignCount,
|
||||
UserHandle = result.User.Id,
|
||||
AaGuid = result.AaGuid.ToString(),
|
||||
AaGuid = result.AaGuid.ToString()
|
||||
};
|
||||
_db.PasskeyCredentials.Add(credential);
|
||||
await _db.SaveChangesAsync();
|
||||
@@ -120,7 +121,7 @@ public class AuthController : ControllerBase
|
||||
var options = _fido2.GetAssertionOptions(new GetAssertionOptionsParams
|
||||
{
|
||||
AllowedCredentials = existingKeys,
|
||||
UserVerification = UserVerificationRequirement.Required,
|
||||
UserVerification = UserVerificationRequirement.Required
|
||||
});
|
||||
|
||||
HttpContext.Session.SetString(AssertOptionsKey, options.ToJson());
|
||||
@@ -152,7 +153,7 @@ public class AuthController : ControllerBase
|
||||
OriginalOptions = options,
|
||||
StoredPublicKey = stored.PublicKey,
|
||||
StoredSignatureCounter = (uint)stored.SignCount,
|
||||
IsUserHandleOwnerOfCredentialIdCallback = isOwner,
|
||||
IsUserHandleOwnerOfCredentialIdCallback = isOwner
|
||||
});
|
||||
|
||||
stored.SignCount = result.SignCount;
|
||||
@@ -186,7 +187,7 @@ public class AuthController : ControllerBase
|
||||
return Ok(new
|
||||
{
|
||||
enrolled = hasCredentials,
|
||||
authenticated = User.Identity?.IsAuthenticated ?? false,
|
||||
authenticated = User.Identity?.IsAuthenticated ?? false
|
||||
});
|
||||
}
|
||||
|
||||
@@ -216,4 +217,4 @@ public class AuthController : ControllerBase
|
||||
await _db.SaveChangesAsync();
|
||||
return Ok(new { message = "All credentials deleted." });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user