Skip to content

Commit

Permalink
Increase state token TTLs. Potential fix for #4.
Browse files Browse the repository at this point in the history
  • Loading branch information
Emzi0767 committed Sep 30, 2020
1 parent 1e3e040 commit 9bb5f8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/cache/RosettaCTF.Cache.Redis/RedisMfaStateRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public async Task<string> GenerateStateAsync(string remoteAddress, ActionToken s
var state = Guid.NewGuid().ToString();
var tkstring = serverToken.ExportString();

await this.Redis.CreateTemporaryValueAsync(remoteAddress, TimeSpan.FromMinutes(2), MfaKey, state);
await this.Redis.CreateTemporaryValueAsync(tkstring, TimeSpan.FromMinutes(2), MfaKey, state, MfaTokenKey);
await this.Redis.CreateTemporaryValueAsync(remoteAddress, TimeSpan.FromMinutes(5), MfaKey, state);
await this.Redis.CreateTemporaryValueAsync(tkstring, TimeSpan.FromMinutes(5), MfaKey, state, MfaTokenKey);
return MfaPrefix + state;
}

Expand Down
4 changes: 2 additions & 2 deletions src/cache/RosettaCTF.Cache.Redis/RedisOAuthStateRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public async Task<string> GenerateStateAsync(string remoteAddress, ActionToken s
var state = Guid.NewGuid().ToString();
var tkstring = serverToken.ExportString();

await this.Redis.CreateTemporaryValueAsync(remoteAddress, TimeSpan.FromMinutes(2), OAuthKey, state);
await this.Redis.CreateTemporaryValueAsync(tkstring, TimeSpan.FromMinutes(2), OAuthKey, state, OAuthTokenKey);
await this.Redis.CreateTemporaryValueAsync(remoteAddress, TimeSpan.FromMinutes(5), OAuthKey, state);
await this.Redis.CreateTemporaryValueAsync(tkstring, TimeSpan.FromMinutes(5), OAuthKey, state, OAuthTokenKey);
return OAuthPrefix + state;
}

Expand Down

0 comments on commit 9bb5f8c

Please # to comment.