Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
mde
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
369764b8
authored
Mar 29, 2017
by
Adi Amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
bugfix: cisco password trunked while reading from environment
parent
6a7e8284
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
docker-compose.yml
src/main/java/logic/CiscoManager.java
docker-compose.yml
View file @
369764b8
...
@@ -3,7 +3,7 @@ mde:
...
@@ -3,7 +3,7 @@ mde:
IPG_ENV_PARAMS
:
"
-Dds.IpAddress=172.16.1.151:8012#
\
IPG_ENV_PARAMS
:
"
-Dds.IpAddress=172.16.1.151:8012#
\
-Dredis.host=172.16.1.151#
\
-Dredis.host=172.16.1.151#
\
-Dmde.cisco.username=devoperator11@cdp.com#
\
-Dmde.cisco.username=devoperator11@cdp.com#
\
-Dmde.cisco.password=
z9E+H=9$J
#
\
-Dmde.cisco.password=
ejlFK0g9OSRK
#
\
-Dmde.cisco.clientId=a27b18484c3c4e08a7c193e42c639347#
\
-Dmde.cisco.clientId=a27b18484c3c4e08a7c193e42c639347#
\
-Dmde.cisco.clientSecret=b863de8f453c4a05A88126F45B958CF1"
-Dmde.cisco.clientSecret=b863de8f453c4a05A88126F45B958CF1"
USE_DEBUG
:
"
yes"
USE_DEBUG
:
"
yes"
...
...
src/main/java/logic/CiscoManager.java
View file @
369764b8
...
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
...
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ArrayNode;
import
com.fasterxml.jackson.databind.node.NullNode
;
import
com.fasterxml.jackson.databind.node.NullNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.google.gdata.util.common.base.PercentEscaper
;
import
com.google.gdata.util.common.base.PercentEscaper
;
import
com.google.gdata.util.common.util.Base64
;
import
http.simpleHttpClient.SimpleHttpClient
;
import
http.simpleHttpClient.SimpleHttpClient
;
import
http.simpleHttpClient.SimpleHttpRequest
;
import
http.simpleHttpClient.SimpleHttpRequest
;
import
http.simpleHttpClient.SimpleHttpResponse
;
import
http.simpleHttpClient.SimpleHttpResponse
;
...
@@ -26,6 +27,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
...
@@ -26,6 +27,7 @@ import org.apache.http.impl.client.DefaultHttpClient;
import
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
;
import
org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.nio.charset.Charset
;
import
java.nio.file.Files
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.nio.file.Paths
;
...
@@ -76,10 +78,24 @@ public class CiscoManager {
...
@@ -76,10 +78,24 @@ public class CiscoManager {
}
}
private
void
LoadLoginInfo
()
{
private
void
LoadLoginInfo
()
{
loginInfo
.
username
=
System
.
getProperty
(
"mde.cisco.username"
,
""
);
loginInfo
.
username
=
getConfigParam
(
"mde.cisco.username"
,
false
,
null
);
loginInfo
.
password
=
System
.
getProperty
(
"mde.cisco.password"
,
""
);
loginInfo
.
password
=
getConfigParam
(
"mde.cisco.password"
,
true
,
null
);
loginInfo
.
clientId
=
System
.
getProperty
(
"mde.cisco.clientId"
,
""
);
loginInfo
.
clientId
=
getConfigParam
(
"mde.cisco.clientId"
,
false
,
null
);
loginInfo
.
clientSecret
=
System
.
getProperty
(
"mde.cisco.clientSecret"
,
""
);
loginInfo
.
clientSecret
=
getConfigParam
(
"mde.cisco.clientSecret"
,
false
,
null
);
}
private
String
getConfigParam
(
String
paramName
,
Boolean
bEscaped
,
String
defaultValue
)
{
try
{
String
paramValue
=
System
.
getProperty
(
paramName
,
defaultValue
);
if
(
paramValue
!=
null
&&
bEscaped
)
{
paramValue
=
new
String
(
Base64
.
decodeWebSafe
(
paramValue
.
getBytes
()),
Charset
.
forName
(
"UTF-8"
));
}
return
paramValue
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"getConfigParam() failed. paramName="
+
paramName
+
" e: "
+
e
.
toString
());
return
null
;
}
}
}
public
BaseRestResponse
executeRequest
(
String
serviceId
,
String
[]
apiIdAsParams
,
RequestContext
requestContext
)
{
public
BaseRestResponse
executeRequest
(
String
serviceId
,
String
[]
apiIdAsParams
,
RequestContext
requestContext
)
{
...
@@ -91,11 +107,11 @@ public class CiscoManager {
...
@@ -91,11 +107,11 @@ public class CiscoManager {
logger
.
info
(
"cisco.executeRequest() started: "
+
getApiIdString
(
apiIdAsParams
));
logger
.
info
(
"cisco.executeRequest() started: "
+
getApiIdString
(
apiIdAsParams
));
// login for the first time
// login for the first time
//
if (loginInfo.loginSuccessfull == false) {
if
(
loginInfo
.
loginSuccessfull
==
false
)
{
brr
=
login
(
loginInfo
);
brr
=
login
(
loginInfo
);
if
(
brr
.
success
==
false
)
if
(
brr
.
success
==
false
)
return
brr
;
return
brr
;
//
}
}
if
(
apiIdAsParams
.
length
==
1
&&
apiIdAsParams
[
0
].
equals
(
"traffic-lanes"
))
{
if
(
apiIdAsParams
.
length
==
1
&&
apiIdAsParams
[
0
].
equals
(
"traffic-lanes"
))
{
brr
=
getTrafficLanes
();
brr
=
getTrafficLanes
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment