Sql – Saving OpenId fields to a database – what are their types/lengths

openidsql server

I'm wanting to save some OpenId fields to a database table, such as

  • OpenId identifier
  • Full Name
  • Alias
  • Email
  • etc..

is there a place that summerizes the datatypes and lengths for all the common schema fields? I know there are custom ones (per provider) .. but what about the common ones?

Eg. email -> nvarchar(250) .. or something.

cheers 🙂

Best Answer

An OpenID identifier can technically be as long as a legal URL can be (practically around 2K), but I'd say 150 characters is a good maximum.

Incidentally be sure to store the Claimed Identifier as the primary key (or equivalent lookup column) rather than the user-supplied identifier or any other variation that you might see in the authentication process. Also, to really be secure, you need to do a case sensitive comparison on the path of the URL (you can be case insensitive in the host area). Since the case sensitivity issue is complicated, I just always normalize the host to lowercase, and then do a case sensitive compare on the whole string.

Related Topic