Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: show how to use spring-social on the login form #12

Open
hlassiege opened this issue Mar 20, 2015 · 9 comments
Open

Suggestion: show how to use spring-social on the login form #12

hlassiege opened this issue Mar 20, 2015 · 9 comments

Comments

@hlassiege
Copy link

That would be interresting to see how to use spring social in order to let the user choose a social login in login.ftl.

@dsyer
Copy link
Collaborator

dsyer commented Mar 31, 2015

You mean in the authserver? It's probably equally interesting to see Spring Social being used as the auth provider (i.e. no auth server). Someone already asked for that (and I think Scott Deeg is working on it)

@hlassiege
Copy link
Author

I imagine that some people could have their own login screen but with an extra option to let the user login from twitter/github/google etc...
But both use case would be very interesting.

@szabobar
Copy link

I agree with hlassiege's question.

@hantsy
Copy link

hantsy commented Oct 19, 2015

I am also working on a project and faced the same problem, my codes is based on oauth2.

  1. Where I put the Spring social security configuration, the ui or resource.
    2, The ui works as a Gateway, should I disable the security in resource, and add security config in UI? I added some public resource(no need to protect) in resource, if I do not change the current security config, the resource will protect all resources by default.
  2. How do I deal with the OAuth SSO when I split the static HTMLs into a new application from ui, eg. a NodeJS web application or ionic based app?
  3. More detailed fine grains Security configuration for oAuth2 or Spring social.

@htshekhada
Copy link

I am trying to add google sign in to this app. can anyone give me hint on how to do that.

@dsyer
Copy link
Collaborator

dsyer commented Sep 14, 2016

Maybe look at the other tutorial and a pull request in particular about Google: spring-guides/tut-spring-boot-oauth2#6).

@htshekhada
Copy link

Thanks Dave,
I am able to integrate google sso (social login) to this project. Following are steps performed to achieve that:

(1) Checkout https://github.com/spring-guides/tut-spring-security-and-angular-js/tree/master/oauth2

(2) Delete "authserver" folder (We will use auth-server from another project)

(3) Checkout auth-server from social demo: https://github.com/spring-guides/tut-spring-boot-oauth2/tree/master/auth-server

(4) Open application.yml of "ui" project and do following changes (https://github.com/spring-guides/tut-spring-security-and-angular-js/blob/master/oauth2/ui/src/main/resources/application.yml)

server.port: 9001
server.context-path: /zuul
debug: true

spring:
  aop:
    proxy-target-class: true


security:
  oauth2:
    client:
      client-id: acme
      client-secret: acmesecret
      access-token-uri: http://localhost:8080/oauth/token
      user-authorization-uri: http://localhost:8080/oauth/authorize
      grant-type: implicit
    resource:
      user-info-uri: http://localhost:8080/me

zuul:
  routes:
    resource:
      path: /resource/**
      url: http://localhost:9000/resource
    user:
      path: /user/**
      url: http://localhost:8080/me

logging:
  level:
    org.springframework.security: DEBUG

(5) Open application.yml of auth-server and add google properties(https://github.com/spring-guides/tut-spring-boot-oauth2/blob/master/auth-server/src/main/resources/application.yml):

google:
  client:
    clientId: <your client id>
    clientSecret: <your client secret>
    accessTokenUri: https://accounts.google.com/o/oauth2/token
    scope: profile,email
    userAuthorizationUri: https://accounts.google.com/o/oauth2/auth
    clientAuthenticationScheme: form
    redirect-uri: http://localhost:8080
  resource:
    userInfoUri: https://www.googleapis.com/plus/v1/people/me

(6) Open SocialApplication.java of auth-server (https://github.com/spring-guides/tut-spring-boot-oauth2/blob/master/auth-server/src/main/java/com/example/SocialApplication.java):
Add google related bean and filters (similar to facebook and github). refere https://github.com/spring-guides/tut-spring-boot-oauth2/pull/6

(7) rename application.properties to application.yml of "resource" project (https://github.com/spring-guides/tut-spring-security-and-angular-js/blob/master/oauth2/resource/src/main/resources/application.properties)
following is the content of that yml:

server:
  port: 9000
  context-path: /resource
security:
  oauth2:
    resource:
      user-info-uri: http://localhost:8080/me

logging:
  level:
    org.springframework.security: DEBUG
    org.springframework.web: DEBUG

(8) Now run auth-server, resource and ui projects and hit "http://localhost:9001/zuul" in browser.

@dsyer
Copy link
Collaborator

dsyer commented Sep 16, 2016

That's nice. But not relevant to this issue/feature. Thanks though.

@maradanasai
Copy link

Hi @dsyer I have read the tutorial on Spring Security and Angular It was amazing but I think it is missing the social login part. Would appreciate if you can add this to part v & part vi of the tutorial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants