Now the validation of ClientId has a max of 255 characters
This commit is contained in:
@@ -20,7 +20,7 @@ public abstract class ClientCredentialsUserControllerBase : UserControllerBase
|
||||
.Build()),
|
||||
BackOfficeUserClientCredentialsOperationStatus.InvalidClientId => BadRequest(problemDetailsBuilder
|
||||
.WithTitle("Invalid client ID")
|
||||
.WithDetail("The specified client ID is invalid. A valid client ID can only contain [a-z], [A-Z], [0-9], and [-._~].")
|
||||
.WithDetail("The specified client ID is invalid. A valid client ID can only contain [a-z], [A-Z], [0-9], and [-._~]. Furthermore, including the prefix it cannot be longer than 255 characters.")
|
||||
.Build()),
|
||||
_ => StatusCode(StatusCodes.Status500InternalServerError, problemDetailsBuilder
|
||||
.WithTitle("Unknown client credentials operation status.")
|
||||
|
||||
@@ -2677,7 +2677,7 @@ internal partial class UserService : RepositoryService, IUserService
|
||||
}
|
||||
}
|
||||
|
||||
[GeneratedRegex(@"^[\w\d\-\._~]*$")]
|
||||
[GeneratedRegex(@"^[\w\d\-\._~]{1,255}$")]
|
||||
private static partial Regex ValidClientId();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1004,6 +1004,7 @@ public class UserServiceTests : UmbracoIntegrationTest
|
||||
[TestCase("@", UserClientCredentialsOperationStatus.InvalidClientId)]
|
||||
[TestCase("[", UserClientCredentialsOperationStatus.InvalidClientId)]
|
||||
[TestCase("]", UserClientCredentialsOperationStatus.InvalidClientId)]
|
||||
[TestCase("More_Than_255_characters_012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789", UserClientCredentialsOperationStatus.InvalidClientId)]
|
||||
public async Task Can_Use_Only_Unreserved_Characters_For_ClientId(string clientId, UserClientCredentialsOperationStatus expectedResult)
|
||||
{
|
||||
// Arrange
|
||||
|
||||
Reference in New Issue
Block a user