{"action":"created","issue":{"url":"https://api.github.com/repos/fromi/spring-google-openidconnect/issues/1","labels_url":"https://api.github.com/repos/fromi/spring-google-openidconnect/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/fromi/spring-google-openidconnect/issues/1/comments","events_url":"https://api.github.com/repos/fromi/spring-google-openidconnect/issues/1/events","html_url":"https://github.com/fromi/spring-google-openidconnect/issues/1","id":56399035,"number":1,"title":"How to trigger authentication from a login page?","user":{"login":"kdekooter","id":508983,"avatar_url":"https://avatars.githubusercontent.com/u/508983?v=3","gravatar_id":"","url":"https://api.github.com/users/kdekooter","html_url":"https://github.com/kdekooter","followers_url":"https://api.github.com/users/kdekooter/followers","following_url":"https://api.github.com/users/kdekooter/following{/other_user}","gists_url":"https://api.github.com/users/kdekooter/gists{/gist_id}","starred_url":"https://api.github.com/users/kdekooter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdekooter/subscriptions","organizations_url":"https://api.github.com/users/kdekooter/orgs","repos_url":"https://api.github.com/users/kdekooter/repos","events_url":"https://api.github.com/users/kdekooter/events{/privacy}","received_events_url":"https://api.github.com/users/kdekooter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-03T16:15:41Z","updated_at":"2015-03-13T09:13:00Z","closed_at":null,"body":"Great work! I am using your code to migrate existing OpenID login code to OpenID connect. \r\nWhat would be the equivalent of posting to ```j_spring_openid_security_check```?"},"comment":{"url":"https://api.github.com/repos/fromi/spring-google-openidconnect/issues/comments/78880522","html_url":"https://github.com/fromi/spring-google-openidconnect/issues/1#issuecomment-78880522","issue_url":"https://api.github.com/repos/fromi/spring-google-openidconnect/issues/1","id":78880522,"user":{"login":"fromi","id":6806494,"avatar_url":"https://avatars.githubusercontent.com/u/6806494?v=3","gravatar_id":"","url":"https://api.github.com/users/fromi","html_url":"https://github.com/fromi","followers_url":"https://api.github.com/users/fromi/followers","following_url":"https://api.github.com/users/fromi/following{/other_user}","gists_url":"https://api.github.com/users/fromi/gists{/gist_id}","starred_url":"https://api.github.com/users/fromi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fromi/subscriptions","organizations_url":"https://api.github.com/users/fromi/orgs","repos_url":"https://api.github.com/users/fromi/repos","events_url":"https://api.github.com/users/fromi/events{/privacy}","received_events_url":"https://api.github.com/users/fromi/received_events","type":"User","site_admin":false},"created_at":"2015-03-13T09:13:00Z","updated_at":"2015-03-13T09:13:00Z","body":"Hi,\r\nHave a look at spring \"OAuth2ClientContextFilter\" class. This filter, if placed early in the filter chain, intercept UserRedirectRequiredException thrown by an OAuth2RestTemplate, and transform that into a redirect.\r\nCheck my last commit: I explicitly add that filter just before the \"OpenIDConnectAuthenticationFilter\". When I tested with Spring Boot embedded container, this was not necessary because somehow OAuth2ClientContextFilter was in the server filter chain before Spring Security filter chain. But once deployed, I was not there anymore, so we have to explicitly declare it. (more robust anyway).\r\n\r\nThen, all you have to do is link your \"Signin with Google\" button to \"/google-oauth2-callback\". The OpenIDConnectAuthenticationFilter will try to fetch user profile using OAuth2RestTemplate, it will fail, throw a UserRedirectRequiredException, which will be then be caught by the OAuth2ClientContextFilter, which will redirect the user to Google.\r\n\r\nAnother (cleaner?) option would be to directly send the user to Google. Problem is to build the right URL. You can see that done in OAuth2ClientContextFilter.redirectUser method, maybe you can find a way to get the redirect URI in the front end.\r\n\r\nHave fun, and do not hesitate to read Spring code, many answers lies there ;)"}}