How to convert email address to username?

Peter Schober peter.schober at univie.ac.at
Sat Feb 20 12:51:14 UTC 2021


* Peter Schober <peter.schober at univie.ac.at> [2021-02-20 13:44]:
> * Mohamed Lrhazi <lrhazi at cua.edu> [2021-02-19 22:22]:
> > Sometimes our users enter their email address at our IdP login
> > page... How would one go about removing @doma.ain part before
> > authentication and any attribute processing etc....
> 
> You could also simply authenticate on either the username *or* the
> email adress making both work seamlessly, avoiding the need for any
> transformations (whether in-browser or on the server).

N.B.: That has a potential side-effect on what "the" authenticated
principal is, then. E.g. if you're using the "PrincipalName"-type
AttributeDefinition you'd end up with either an email address or a
username.
I'd avoid "PrincipalName" in attribute defintions if possible anyway
and instead look up the -- hopefully normalized values -- from LDAP or
your RDBMS, which also avoids any case inconsistencies.

This also supports more complex transformations (going from
email-adress to username or vice versa) than would be possible via
regex-based Transformations. (E.g. in our deployment you can't derive
the username from the email address at all, you'd have to perform a
look-up.)

-peter


More information about the users mailing list