Restrictions in user name?

I use RedisAuthRepository as user auth repository. I was searching through the code (only very quickly) and I wonder if there are any restrictions for the user name. With restriction I mean forbidden characters and length.

With Redis, at least the length should not be a problem (in opposition to a RDBMS). However do you have any restrictions built in such as forbidden characters like @/$\ etc.?

Thanks, Tom

Please see the Username Validation in the Docs.

Fundamentally the Username can’t have @ which ServiceStack assumes to be an Email and will validate against the Email field. By default ServiceStack uses AuthFeatureExtensions.ValidUserNameRegEx to validate Usernames:

Regex ValidUserNameRegEx = new Regex(@"^(?=.{3,20}$)([A-Za-z0-9][._-]?)*$$");

This can be overridden in the AuthFeature plugin:

Plugins.Add(new AuthFeature(...){
    ValidUserNameRegEx = new Regex(@"^(?=.{3,20}$)([A-Za-z0-9][._-]?)*$$", RegexOptions.Compiled),  

Or can be overridden by specifying a IsValidUsernameFn predicate:

Plugins.Add(new AuthFeature(...){
    IsValidUsernameFn = userName => userName.IndexOfAny(new[] { '@', '.', ' ' }) == -1

Thanks a lot, exactly what I was looking for!