Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,15 @@ public async Task<LoginResult> LoginAsync(AuthFlowContext flow, LoginRequest req
{
var chain = await sessionStore.GetChainByDeviceAsync(userKey.Value, deviceId, ct);

if (chain is not null && !chain.IsRevoked)
chainId = chain.ChainId;
if (chain is not null)
{
var chainState = chain.GetState(now, _options.Session.IdleTimeout);

if (chainState == SessionState.Active)
{
chainId = chain.ChainId;
}
}
}

// TODO: Add accountState here, currently it only checks factor state
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,13 @@ await kernel.ExecuteAsync(async _ =>
//chain = await kernel.GetChainAsync(context.ChainId.Value)
// ?? throw new UAuthNotFoundException("Chain not found.");

if (chain.IsRevoked)
throw new UAuthValidationException("Chain revoked.");
var chainState = chain.GetState(now, _options.Session.IdleTimeout);

if (chainState != SessionState.Active)
throw new UAuthValidationException("Chain is not active.");

//if (chain.IsRevoked)
// throw new UAuthValidationException("Chain revoked.");

if (chain.UserKey != context.UserKey || chain.Tenant != context.Tenant)
throw new UAuthValidationException("Invalid chain ownership.");
Expand Down
Loading