{"id":827,"date":"2011-04-01T14:01:00","date_gmt":"2011-04-01T12:01:00","guid":{"rendered":""},"modified":"2022-08-02T14:59:04","modified_gmt":"2022-08-02T12:59:04","slug":"spring-security-by-example-openid-login-via-gmail","status":"publish","type":"post","link":"https:\/\/touk.pl\/blog\/2011\/04\/01\/spring-security-by-example-openid-login-via-gmail\/","title":{"rendered":"<!--:en-->Spring Security by example: OpenID (login via gmail)<!--:-->"},"content":{"rendered":"<p><!--:pl--><\/p>\n<p><!--:--><!--:en--><\/p>\n<div dir=\"ltr\">\n<p>This is a part of a simple Spring Security tutorial:<\/p>\n<p>1.\u00a0<a href=\"http:\/\/blog.solidcraft.eu\/2011\/03\/spring-security-by-example-set-up-and.html\">Set up and form authentication\u00a0<\/a><\/p>\n<p>2.\u00a0<a href=\"http:\/\/blog.solidcraft.eu\/2011\/03\/spring-security-by-example-user-in.html\">User in the backend (getting logged user, authentication, testing)<\/a><\/p>\n<p>3.\u00a0<a href=\"http:\/\/blog.solidcraft.eu\/2011\/03\/spring-security-by-example-securing-web.html\">Securing web resources<\/a><\/p>\n<p>4.\u00a0<a href=\"http:\/\/blog.solidcraft.eu\/2011\/03\/spring-security-by-example-securing.html\">Securing methods<\/a><\/p>\n<p>5.\u00a0<strong>OpenID (login via gmail)<\/strong><\/p>\n<p>6. OAuth2 (login via Facebook)<\/p>\n<p>7. Writing on Facebook wall with Spring Social<\/p>\n<p>OpenID is to form authentication, what DVCS is to centralized version control system.<\/p>\n<p>Ok, but without the technical mumbo-jumbo: OpenID allows the user to use one account (like Gmail) to login to other services (websites) without having to remember anything and without worries about password security.<\/p>\n<p>Easy enough?<\/p>\n<p>And the best part is: chances are, you already have an account which is a provider to OpenID. Are you registered on Gmail, Yahoo, or even Blogger? You can already use it to login to other sites.<\/p>\n<p>But why would you? Isn&#8217;t login\/password good enough?<\/p>\n<p>Have you ever wondered whether the service you are logging to, uses one-way password hashing or keeps the password as open text? Most users do not create password per site because they cannot remember more than, let&#8217;s say, three passwords. If one site keeps their password as open text, they are practically screwed. And more often than not, it&#8217;s the site that has the worst (or non-existing) security. Welcome to hell: all your bases are belong to us.<\/p>\n<p>By the way, I know of only one site, which does SHA hashing on the client side (in javascript), so that the server has no way of knowing what the real password is: sprezentuj.pl<\/p>\n<p>Kudos for that, though it smells like overengineering a bit :)<\/p>\n<p>OpenID is pretty simple, and the process description at\u00a0<a href=\"http:\/\/en.wikipedia.org\/wiki\/OpenID\">Wikipedia<\/a>\u00a0is practically everything you need, but as they say, one picture is worth 1000 words, so let&#8217;s look at a\u00a0 picture. There is a loot you can find with google, but most of them are in big-arrows-pointing-some-boxes-notation, and I find easier to read a sequence diagram, so here is my take on it:<\/p>\n<\/div>\n<p><a href=\"http:\/\/blog.solidcraft.eu\/2011\/04\/spring-security-by-example-openid-login.html#more\">Read more \u00bb<\/a><\/p>\n<p><!--:--><\/p>\n","protected":false},"excerpt":{"rendered":"This is a part of a simple Spring Security tutorial:\n1. Set up and form authentication\n2. User in the backend (getting logged user, authentication, testing)\n3. Securing web resources\n4. Securing methods\n5. OpenID (login via gmail)\n6. OAuth2 (login v&#8230;This is a part of a simple Spring Security tutorial:\n1. Set up and form authentication\n2. User in the backend (getting logged user, authentication, testing)\n3. Securing web resources\n4. Securing methods\n5. OpenID (login via gmail)\n6. OAuth2 (login v&#8230;\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[68,42],"class_list":{"0":"post-827","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-development-design","7":"tag-java","8":"tag-spring-framework"},"_links":{"self":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/827","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/comments?post=827"}],"version-history":[{"count":32,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/827\/revisions"}],"predecessor-version":[{"id":14869,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/posts\/827\/revisions\/14869"}],"wp:attachment":[{"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/media?parent=827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/categories?post=827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/touk.pl\/blog\/wp-json\/wp\/v2\/tags?post=827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}