fix: API tokens use the mos_ prefix [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful
ci/woodpecker/push/main-amd64-build Pipeline was successful
This commit is contained in:
1 parent
18a6898a27
commit
ef75c9f510
2 files changed
+2
-2
No files matched your search
@@ -140,7 +140,7 @@ public sealed partial class AuthService
|
||||
return ValidationError.Fail<CreatedApiToken>("scope", "must be read, admin or release");
|
||||
}
|
||||
|
||||
string plaintext = TokenHash.NewToken("mon");
|
||||
string plaintext = TokenHash.NewToken("mos");
|
||||
var record = new ApiTokenRecord(Ulid.NewPrefixed("tok", _time), name, scope, TokenHash.Sha256(plaintext), _time.GetUtcNow().ToUnixTimeMilliseconds(), null, null);
|
||||
await _store.CreateApiTokenAsync(record, ct);
|
||||
return Result<CreatedApiToken>.Ok(new CreatedApiToken(record, plaintext));
|
||||
|
||||
@@ -139,7 +139,7 @@ public sealed class ApiBasicsTests
|
||||
Assert.Equal(HttpStatusCode.OK, read.StatusCode);
|
||||
|
||||
using HttpClient bogus = _backend.NewClient();
|
||||
bogus.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "mon_bogus");
|
||||
bogus.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "mos_bogus");
|
||||
using HttpResponseMessage unknown = await bogus.GetAsync("/api/admin/agents");
|
||||
Assert.Equal(HttpStatusCode.Unauthorized, unknown.StatusCode);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user