Adds template to store google api id and secret.

maven
damencho 11 years ago
parent 4b124d7b8a
commit 36fa64b302

@ -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"

@ -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";
}

@ -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.

Loading…
Cancel
Save