branch feature/1_socialauth updated (6c2eaa6f -> 85efd12e)
This is an automated email from the git hooks/post-receive script. New change to branch feature/1_socialauth in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 6c2eaa6f refs #1 utilisation de la lib socialauth pour se connecter via des services tiers new 85efd12e refs #1 connexion avec google The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 85efd12eaf40960f468702ca89b233cd8109646f Author: Kevin Morin <morin@codelutin.com> Date: Thu Aug 24 11:05:45 2017 +0200 refs #1 connexion avec google Summary of changes: .../src/main/java/org/chorem/pollen/rest/api/v1/AuthApi.java | 3 --- .../org/chorem/pollen/services/service/SocialAuthService.java | 2 ++ pollen-ui-riot-js/src/main/web/js/AuthService.js | 6 ++++-- pollen-ui-riot-js/src/main/web/js/Session.js | 8 ++++---- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 10 +++++----- pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html | 9 +++++---- 6 files changed, 20 insertions(+), 18 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/1_socialauth in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 85efd12eaf40960f468702ca89b233cd8109646f Author: Kevin Morin <morin@codelutin.com> Date: Thu Aug 24 11:05:45 2017 +0200 refs #1 connexion avec google --- .../src/main/java/org/chorem/pollen/rest/api/v1/AuthApi.java | 3 --- .../org/chorem/pollen/services/service/SocialAuthService.java | 2 ++ pollen-ui-riot-js/src/main/web/js/AuthService.js | 6 ++++-- pollen-ui-riot-js/src/main/web/js/Session.js | 8 ++++---- pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html | 10 +++++----- pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html | 9 +++++---- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/AuthApi.java b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/AuthApi.java index 55541664..7a7b74bb 100644 --- a/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/AuthApi.java +++ b/pollen-rest-api/src/main/java/org/chorem/pollen/rest/api/v1/AuthApi.java @@ -212,9 +212,6 @@ public class AuthApi { Gson gson = new Gson(); Map<String, String> paramsMap = gson.fromJson(authorization, Map.class); PollenEntityRef<PollenUser> userPollenEntityRef = socialAuthService.login(providerId, providerRedirection, paramsMap); - - - return getLoginResponseFromPollenUser(serviceContext, securityService, securityContext, userPollenEntityRef); } diff --git a/pollen-services/src/main/java/org/chorem/pollen/services/service/SocialAuthService.java b/pollen-services/src/main/java/org/chorem/pollen/services/service/SocialAuthService.java index 47cb08dd..6866b3b5 100644 --- a/pollen-services/src/main/java/org/chorem/pollen/services/service/SocialAuthService.java +++ b/pollen-services/src/main/java/org/chorem/pollen/services/service/SocialAuthService.java @@ -6,6 +6,7 @@ import org.brickred.socialauth.AuthProvider; import org.brickred.socialauth.Profile; import org.brickred.socialauth.SocialAuthConfig; import org.brickred.socialauth.SocialAuthManager; +import org.brickred.socialauth.util.Constants; import org.chorem.pollen.persistence.entity.PollenUser; import org.chorem.pollen.persistence.entity.PollenUserImpl; import org.chorem.pollen.persistence.entity.PollenUserTopiaDao; @@ -38,6 +39,7 @@ public class SocialAuthService extends PollenServiceSupport { SocialAuthManager manager = getSocialAuthManager(); manager.getAuthenticationUrl(providerId, redirection); + paramsMap.remove(Constants.STATE); AuthProvider provider = manager.connect(paramsMap); // get profile diff --git a/pollen-ui-riot-js/src/main/web/js/AuthService.js b/pollen-ui-riot-js/src/main/web/js/AuthService.js index 23b87d3a..42052f20 100644 --- a/pollen-ui-riot-js/src/main/web/js/AuthService.js +++ b/pollen-ui-riot-js/src/main/web/js/AuthService.js @@ -68,9 +68,11 @@ class AuthService extends FetchService { return this.post("/v1/resendValidation", email); } - signInProvider(provider, query, providerRedirection) { + signInProvider(query, providerRedirection) { + console.log(query) + console.log(providerRedirection) return this.fetch( - "/v1/login/" + provider, + "/v1/login/" + query.loginProvider, "POST", {Authorization: JSON.stringify(query)}, providerRedirection); diff --git a/pollen-ui-riot-js/src/main/web/js/Session.js b/pollen-ui-riot-js/src/main/web/js/Session.js index d1af7ac7..b2deb15e 100644 --- a/pollen-ui-riot-js/src/main/web/js/Session.js +++ b/pollen-ui-riot-js/src/main/web/js/Session.js @@ -133,8 +133,8 @@ class Session { return authService.signIn(login, password).then(auth => this.updateConnection(auth, this)); } - signInProvider(provider, query) { - return authService.signInProvider(provider, query, this.getProviderRedirectionUrl(query.redirect)) + signInProvider(query) { + return authService.signInProvider(query, this.getProviderRedirectionUrl(query.loginProvider)) .then(auth => this.updateConnection(auth, this)); } @@ -169,8 +169,8 @@ class Session { }); } - getProviderRedirectionUrl(redirect) { - return this.pollenUIContext.uiEndPoint + "/?redirect=" + redirect; + getProviderRedirectionUrl(provider) { + return this.pollenUIContext.uiEndPoint + "/?loginProvider=" + provider; } } diff --git a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html index 1ac4f6cb..36ca5983 100644 --- a/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/Pollen.tag.html @@ -219,11 +219,11 @@ require("./popup/InformationPopup.tag.html"); route(() => { var q = route.query(); - console.log(q); - console.log(q.redirect); - if (q.redirect != null) { - session.signInProvider("facebook", q).then(() => { - location.href = session.pollenUIContext.uiEndPoint + "/" + unescape(decodeURIComponent(q.redirect)); + if (q.loginProvider != null) { + session.signInProvider(q).then(() => { + let currentPage = localStorage.getItem("currentPage"); + localStorage.removeItem("currentPage"); + location.href = session.pollenUIContext.uiEndPoint + "/" + currentPage; }); } else { diff --git a/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html b/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html index 739345e8..2ce478c5 100644 --- a/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html +++ b/pollen-ui-riot-js/src/main/web/tag/SignIn.tag.html @@ -57,9 +57,9 @@ require("./components/HumanInput.tag.html"); </div> <a onclick="{newPassword}">{__.lostpassword}</a> </form> - <p>Ou connectez vous avec votre compte + <p>Ou connectez vous avec votre compte : <a onclick="{signinWithProvider('facebook')}"><i class="fa fa-facebook-official"></i></a> - <a onclick="{signinWithProvider('linkedin')}"><i class="fa fa-linkedin-square"></i></a> + <a onclick="{signinWithProvider('googleplus')}"><i class="fa fa-google"></i></a> </p> </div> @@ -112,9 +112,10 @@ require("./components/HumanInput.tag.html"); }; this.signinWithProvider = (provider) => (e) => { - let redirect = location.hash || "#"; + let currentPage = location.hash || "#"; + localStorage.setItem("currentPage", currentPage); location.href = this.session.configuration.endPoint + "/v1/login/" + provider - + "?providerRedirection=" + this.session.getProviderRedirectionUrl(escape(encodeURIComponent(redirect))); + + "?providerRedirection=" + encodeURIComponent(this.session.getProviderRedirectionUrl(provider)); }; </script> -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm