aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordamencho <damencho@jitsi.org>2015-07-20 17:06:49 -0500
committerdamencho <damencho@jitsi.org>2015-07-20 17:06:49 -0500
commit36fa64b302eccf7d322ecd29302de6f96134113a (patch)
tree4e6692310e415c415f3551a0a218219b31a7e6cd
parent4b124d7b8a79739686aac64450b2ba390217087e (diff)
downloadjitsi-36fa64b302eccf7d322ecd29302de6f96134113a.zip
jitsi-36fa64b302eccf7d322ecd29302de6f96134113a.tar.gz
jitsi-36fa64b302eccf7d322ecd29302de6f96134113a.tar.bz2
Adds template to store google api id and secret.
-rw-r--r--build.xml35
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java.tmpl35
-rw-r--r--src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java6
3 files changed, 73 insertions, 3 deletions
diff --git a/build.xml b/build.xml
index 9abd942..d963c42 100644
--- a/build.xml
+++ b/build.xml
@@ -293,7 +293,7 @@
</target>
<!-- java compile -->
- <target name="compile" depends="init,version">
+ <target name="compile" depends="init,version,-pre-googlecontacts">
<!--internal-target- compiles the entire project source tree -->
<javac classpathref="compile.class.path" debug="true"
deprecation="true" destdir="${dest}" nowarn="false"
@@ -1378,6 +1378,39 @@
</jar>
</target>
+ <!-- Fills google client code id and secret if any -->
+ <target name="-pre-googlecontacts"
+ depends="-pre-googlecontacts-none"
+ if="google.api.client.id" >
+ <!-- create a class that would contain our id and secret if any -->
+ <copy file="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java.tmpl"
+ tofile="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java"
+ overwrite="true"/>
+
+ <!-- set the id and secret according to the property -->
+ <replace file="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java"
+ token="google.api.client.id" value="${google.api.client.id}"/>
+
+ <!-- set the secret according to the property -->
+ <replace file="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java"
+ token="google.api.client.secret" value="${google.api.client.secret}"/>
+ </target>
+ <!-- if nothing is set just replace it with null -->
+ <target name="-pre-googlecontacts-none" unless="google.api.client.id" >
+ <!-- create a class that would contain our id and secret if any -->
+ <copy file="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java.tmpl"
+ tofile="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java"
+ overwrite="true"/>
+
+ <!-- set the id and secret according to the property -->
+ <replace file="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java"
+ token="&#34;google.api.client.id&#34;" value="null"/>
+
+ <!-- set the secret according to the property -->
+ <replace file="${src}/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java"
+ token="&#34;google.api.client.secret&#34;" value="null"/>
+ </target>
+
<!--BUNDLE-GOOGLECONTACTS-->
<target name="bundle-googlecontacts" depends="bundle-httputil,bundle-browserlauncher">
<jar compress="false" destfile="${bundles.dest}/googlecontacts.jar"
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java.tmpl b/src/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java.tmpl
new file mode 100644
index 0000000..5f3b6d7
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/googlecontacts/GoogleAPIClientToken.java.tmpl
@@ -0,0 +1,35 @@
+/*
+ * Copyright @ 2015 Atlassian Pty Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.java.sip.communicator.impl.googlecontacts;
+
+/**
+ * This file is auto-updated by build.xml in order to provide id and secret
+ * needed to use oauth2 for accessing google api.
+ *
+ * @author Damian Minkov
+ */
+public class GoogleAPIClientToken
+{
+ /**
+ * Client ID for OAuth 2 based authentication.
+ */
+ static final String GOOGLE_API_CLIENT_ID = "google.api.client.id";
+
+ /**
+ * Client secret for OAuth 2 based authentication.
+ */
+ static final String GOOGLE_API_CLIENT_SECRET = "google.api.client.secret";
+}
diff --git a/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java b/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java
index bd64bb7..cf2cca7 100644
--- a/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java
+++ b/src/net/java/sip/communicator/impl/googlecontacts/OAuth2TokenStore.java
@@ -94,12 +94,14 @@ public class OAuth2TokenStore
/**
* Client ID for OAuth 2 based authentication.
*/
- private static final String GOOGLE_API_CLIENT_ID = null;
+ private static final String GOOGLE_API_CLIENT_ID
+ = GoogleAPIClientToken.GOOGLE_API_CLIENT_ID;
/**
* Client secret for OAuth 2 based authentication.
*/
- private static final String GOOGLE_API_CLIENT_SECRET = null;
+ private static final String GOOGLE_API_CLIENT_SECRET
+ = GoogleAPIClientToken.GOOGLE_API_CLIENT_SECRET;
/**
* Required OAuth 2 authentication scopes.