Skip to content

Commit

Permalink
Merge pull request #833 from taylorhadden/ERGoogleSignIn
Browse files Browse the repository at this point in the history
Sign in with google easily with ERGoogleSignIn
  • Loading branch information
darkv authored Apr 27, 2017
2 parents a6ddf91 + 6dd87f6 commit 10bbfca
Show file tree
Hide file tree
Showing 40 changed files with 631 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Build/build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1116,12 +1116,19 @@
</antcall>
</target>

<target name="ERGoogleSignIn.all">
<antcall target="global.framework.${build.action}">
<param name="project.dir" value="Frameworks/Misc/ERGoogleSignIn" />
<param name="wo.external.root.bundles" value="${frameworks.wonder.core}" />
</antcall>
</target>

<!--
The targets here correspond to a top-level directory, split into frameworks, apps and examples
to add your own, add a target definition above and choose the correct group below
-->

<target name="common.frameworks.all" depends="ERJars.all, JavaWOExtensions.all, ERExtensions.all, Ajax.all, ERDirectToWeb.all, ERNeutralLook.all, ERSelenium.all, WOOgnl.all, ERPrototypes.all, ERPlot.all, ERIndexing.all, ERChronic.all, ERCaptcha.all, ERProfiling.all, EROpenID.all, ERJaxWS.all, ERPDFGeneration.all, ERJGroupsSynchronizer.all, ERRest.all, ERAttachment.all, ERTaggable.all, ERCMail.all, ERJavaMail.all, ERCoreBusinessLogic.all, ERChangeNotificationJMS.all, ERCalendar.all, ERExcelLook.all, BTBusinessLogic.all, JavaMemoryAdaptor.all, JavaNeo4JAdaptor.all, JavaLuceneAdaptor.all, JavaFSAdaptor.all, JavaERJDBCAdaptor.all, WOLips.all, WOJRebel.all, ERMoviesLogic.all, SnapshotExplorer.all, ERJasperReports.all, ERAttributeExtension.all, ERWOAdaptor.all, ERCayenne.all, ERCayenne.all, ERDistribution.all, MooTools.all, ERJQueryMobile.all, ERJQMobile.all, ERPersistentSessionStorage.all, ERQuartzScheduler.all, ERXiss.all, ERFirebug.all, ERXPartialBaseModel.all, ERXPartialsExampleModel.all" />
<target name="common.frameworks.all" depends="ERJars.all, JavaWOExtensions.all, ERExtensions.all, Ajax.all, ERDirectToWeb.all, ERNeutralLook.all, ERSelenium.all, WOOgnl.all, ERPrototypes.all, ERPlot.all, ERIndexing.all, ERChronic.all, ERCaptcha.all, ERProfiling.all, EROpenID.all, ERJaxWS.all, ERPDFGeneration.all, ERJGroupsSynchronizer.all, ERRest.all, ERAttachment.all, ERTaggable.all, ERCMail.all, ERJavaMail.all, ERCoreBusinessLogic.all, ERChangeNotificationJMS.all, ERCalendar.all, ERExcelLook.all, BTBusinessLogic.all, JavaMemoryAdaptor.all, JavaNeo4JAdaptor.all, JavaLuceneAdaptor.all, JavaFSAdaptor.all, JavaERJDBCAdaptor.all, WOLips.all, WOJRebel.all, ERMoviesLogic.all, SnapshotExplorer.all, ERJasperReports.all, ERAttributeExtension.all, ERWOAdaptor.all, ERCayenne.all, ERCayenne.all, ERDistribution.all, MooTools.all, ERJQueryMobile.all, ERJQMobile.all, ERPersistentSessionStorage.all, ERQuartzScheduler.all, ERXiss.all, ERFirebug.all, ERGoogleSignIn.all, ERXPartialBaseModel.all, ERXPartialsExampleModel.all" />

<target name="common.applications.all" depends="BugTracker.all, ERMailer.all, Uber.all, SecretPal.all, ERXTest.all, PluginTest.all, WOTested.all" />

Expand Down
31 changes: 31 additions & 0 deletions Frameworks/Misc/ERGoogleSignIn/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="Sources"/>
<classpathentry kind="con" path="WOFramework/ERExtensions"/>
<classpathentry kind="con" path="WOFramework/ERJars"/>
<classpathentry kind="con" path="WOFramework/ERPrototypes"/>
<classpathentry kind="con" path="WOFramework/ERAttributeExtension"/>
<classpathentry kind="con" path="WOFramework/JavaWOExtensions"/>
<classpathentry kind="con" path="WOFramework/WOOgnl"/>
<classpathentry kind="con" path="WOFramework/JavaEOAccess"/>
<classpathentry kind="con" path="WOFramework/JavaEOControl"/>
<classpathentry kind="con" path="WOFramework/JavaFoundation"/>
<classpathentry kind="con" path="WOFramework/JavaJDBCAdaptor"/>
<classpathentry kind="con" path="WOFramework/JavaWebObjects"/>
<classpathentry kind="con" path="WOFramework/JavaXML"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry exported="true" kind="lib" path="Libraries/commons-logging-1.1.1.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-api-client-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-api-client-gson-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-api-client-java6-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-http-client-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-http-client-gson-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-oauth-client-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/google-oauth-client-java6-1.22.0.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/gson-2.1.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/httpclient-4.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/httpcore-4.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/jetty-6.1.26.jar"/>
<classpathentry exported="true" kind="lib" path="Libraries/jetty-util-6.1.26.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
2 changes: 2 additions & 0 deletions Frameworks/Misc/ERGoogleSignIn/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build/
bin/
23 changes: 23 additions & 0 deletions Frameworks/Misc/ERGoogleSignIn/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ERGoogleSignIn</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.objectstyle.wolips.incrementalbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.objectstyle.wolips.incrementalframeworknature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//Components=UTF-8
16 changes: 16 additions & 0 deletions Frameworks/Misc/ERGoogleSignIn/Components/ERGoogleLoginForm.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
<wo class="ERGoogleLoginForm" wocomponentcontent="false"> <binding name="clientID"/>
<binding name="clientIDName"/>
<binding name="directActionClass"/>
<binding name="directActionName"/>
<binding name="error"/>
<validation message="'error' is a required binding.">
<unbound name="error"/>
</validation>
<binding name="formName"/>
<binding name="id"/>
<binding name="includePlatformScript"/>
<binding name="tokenFieldName"/>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<webobject name = "GoogleContainer"></webobject>
<webobject name = "GoogleForm">
<webobject name = "AuthenticationTokenField"></webobject>
</webobject>

<wo:WOConditional condition = "$includePlatformScript">
<script src="https://apis.google.com/js/platform.js"></script>
</wo:WOConditional>
<script>
var invalidUser = false;
<wo:WOConditional condition = "$^error">invalidUser = true;</wo:WOConditional>

gapi.load('auth2', function() {
auth2 = gapi.auth2.init({
client_id: '<wo:WOString value = "$clientID"/>'
});

auth2.currentUser.listen(function(user) {
if (invalidUser) {
auth2.signOut().then(function() { invalidUser = false; });
}
else {
let token = user.getAuthResponse().id_token;
if (token) {
var form = document.forms['<wo:WOString value = "$formName"/>'];
form.<wo:WOString value = "$tokenFieldName"/>.value = token;
form.submit();
}
}
});
});

gapi.signin2.render('<wo:WOString value = "$id"/>');
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
GoogleContainer : WOGenericContainer {
elementName = "div";
id = id;
}

GoogleForm : WOForm {
style = "display: none;";
multipleSubmit = false;
name = formName;
directActionName = directActionName;
actionClass = directActionClass;
}

AuthenticationTokenField : WOTextField {
value = token;
name = tokenFieldName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"WebObjects Release" = "WebObjects 5.0";
encoding = "UTF-8";
}
13 changes: 13 additions & 0 deletions Frameworks/Misc/ERGoogleSignIn/Components/ERGoogleLogoutLink.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<wodefinitions>
<wo class="ERGoogleLogoutLink" wocomponentcontent="true"> <binding name="action"/>
<validation message="'action' is a required binding.">
<unbound name="action"/>
</validation>
<binding name="clientID"/>
<binding name="clientIDName"/>
<binding name="includeInitializationScript"/>
<binding name="includePlatformScript"/>
<binding name="target"/>
</wo>
</wodefinitions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<wo:WOConditional condition = "$includePlatformScript"><script src="https://apis.google.com/js/platform.js"></script></wo:WOConditional>
<wo:WOConditional condition = "$includeInitializationScript">
<script>
var auth2;
gapi.load('auth2', function() {
auth2 = gapi.auth2.init({
client_id: '<wo:WOString value = "$clientID"/>'
});
});
</script>
</wo:WOConditional>
<webobject name = "Link"><webobject name = "Content"></webobject></webobject>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Link : WOHyperlink {
action = ^action;
target = ^target;
onclick = "gapi.auth2.getAuthInstance().signOut(); return true;";
}

Content : WOComponentContent {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"WebObjects Release" = "WebObjects 5.0";
encoding = "UTF-8";
}
Loading

0 comments on commit 10bbfca

Please sign in to comment.