1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-02 00:22:50 -05:00

Revert filescoped (#2227)

* Revert "Add git blame entry (#2226)"

This reverts commit 239286737d.

* Revert "Turn on file scoped namespaces (#2225)"

This reverts commit 34fb4cca2a.
This commit is contained in:
Justin Baur
2022-08-29 15:53:48 -04:00
committed by GitHub
parent 239286737d
commit bae03feffe
1208 changed files with 74317 additions and 73126 deletions

View File

@ -1,36 +1,37 @@
using Microsoft.AspNetCore.DataProtection;
namespace Bit.Core.Tokens;
public class Token
namespace Bit.Core.Tokens
{
private readonly string _token;
public Token(string token)
public class Token
{
_token = token;
}
private readonly string _token;
public Token WithPrefix(string prefix)
{
return new Token($"{prefix}{_token}");
}
public Token RemovePrefix(string expectedPrefix)
{
if (!_token.StartsWith(expectedPrefix))
public Token(string token)
{
throw new BadTokenException($"Expected prefix, {expectedPrefix}, was not present.");
_token = token;
}
return new Token(_token[expectedPrefix.Length..]);
public Token WithPrefix(string prefix)
{
return new Token($"{prefix}{_token}");
}
public Token RemovePrefix(string expectedPrefix)
{
if (!_token.StartsWith(expectedPrefix))
{
throw new BadTokenException($"Expected prefix, {expectedPrefix}, was not present.");
}
return new Token(_token[expectedPrefix.Length..]);
}
public Token ProtectWith(IDataProtector dataProtector) =>
new(dataProtector.Protect(ToString()));
public Token UnprotectWith(IDataProtector dataProtector) =>
new(dataProtector.Unprotect(ToString()));
public override string ToString() => _token;
}
public Token ProtectWith(IDataProtector dataProtector) =>
new(dataProtector.Protect(ToString()));
public Token UnprotectWith(IDataProtector dataProtector) =>
new(dataProtector.Unprotect(ToString()));
public override string ToString() => _token;
}