Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving OpenId fields to a database - what are their types/lengths?

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 :)

like image 449
Pure.Krome Avatar asked Dec 07 '08 11:12

Pure.Krome


2 Answers

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.

like image 112
Andrew Arnott Avatar answered Oct 21 '22 09:10

Andrew Arnott


Use common sense for the email. I've never seen an email address longer than 40-50 chars. Any address that is longer, may be spam or a fake one.

edit: looking at the email RFC, the maximum length of an email address may be 64 (the username) + 1 (the '@' char) + 255 (the domain). Anyway, I would go for a maximum length of 100 or less, still.

like image 26
friol Avatar answered Oct 21 '22 07:10

friol