mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-10-30 01:55:58 +01:00
Check token content before handling them
This adds plausibility checks before handling tokens as for example jwt or api keys. Doing so we generate less error logs and therefore we cause less confusion.
This commit is contained in:
@@ -96,6 +96,15 @@ class ApiKeyRealmTest {
|
||||
assertThrows(AuthorizationException.class, () -> realm.doGetAuthenticationInfo(token));
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldIgnoreTokensWithDots() {
|
||||
BearerToken token = valueOf("this.is.no.api.token");
|
||||
|
||||
boolean supports = realm.supports(token);
|
||||
|
||||
assertThat(supports).isFalse();
|
||||
}
|
||||
|
||||
void verifyScopeSet(String... permissions) {
|
||||
verify(authenticationInfoBuilder).withScope(argThat(scope -> {
|
||||
assertThat(scope).containsExactly(permissions);
|
||||
|
||||
Reference in New Issue
Block a user