PWP registration workflow
In the PWD registration flow, a username and password are requested. It is possible to register a user by adding a valid email address to the username field. However, when logging in, the following error occurs:
ArgumentException: Invalid cookie name: [email protected] (Parameter 'value') Microsoft.Net.Http.Headers.CookieHeaderValue.CheckNameFormat(StringSegment name, string parameterName)
Register:
User created:
Login:
Error on submit:
Is it possible to implement a registration flow where the user is able to register with "email (in the username field) and password" to log in?
What should I do to make possible to do it this way, since it is how applications with identity server usually do it. In my case, I would like to force the username to always be an email address in the registration step and validate the email using code in a second step in my application.
To always use the email as the login, the property IsEmailUsedDuringAuthentication must be set to true.
Edit the Program.cs file and modify the options as follows:
idServerBuilder = services.AddSIDIdentityServer(callback: cb =>
{
cb.IsEmailUsedDuringAuthentication = true;
if (!string.IsNullOrWhiteSpace(identityServerConfiguration.SessionCookieNamePrefix))
cb.SessionCookieName = identityServerConfiguration.SessionCookieNamePrefix;
cb.Authority = identityServerConfiguration.Authority;
cb.ScimClientOptions = conf;
}, cookie: c =>
{
if (!string.IsNullOrWhiteSpace(identityServerConfiguration.AuthCookieNamePrefix))
c.Cookie.Name = identityServerConfiguration.AuthCookieNamePrefix;
}, dataProtectionBuilderCallback: ConfigureDataProtection)
Configuring the Registration Workflow
Follow these steps to configure the registration workflow:
- Open the administration website and navigate to the
Manual Identity Provisioningsection. - Click the
add registration workflowbutton and fill out the form with the following values:
- Name : workflow
- Auth methods : pwd, email
- Click the
addbutton to confirm the creation.
The registration workflow is now ready for use and can be accessed via the following URL:: https://localhost:5001/master/registration?workflowName=workflow
Checking Email Client Configuration
Before launching the registration workflow, ensure the email client is properly configured:
- Open the administration website and navigate to the
Authenticationwindow. - Click on the
Emailelement and verify that the configuration is correct.
Known issue
There is currently a minor issue with cookie creation. This issue will be resolved in the Release503 branch.
The issue has been fixed in the Release503 branch.
Now, when the login is in an email format, authentication will work. :)