Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fogbow
fogbow4j
Commits
e932d736
Commit
e932d736
authored
Apr 17, 2015
by
Abmar Barros
Browse files
normalizing tokens
parent
048ec83f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/fogbowcloud/cli/FogbowClient.java
View file @
e932d736
...
...
@@ -28,7 +28,7 @@ public class FogbowClient {
public
FogbowClient
(
String
managerHost
,
Integer
managerPort
,
String
federationAuthToken
)
{
this
.
managerHost
=
managerHost
;
this
.
managerPort
=
managerPort
;
this
.
federationAuthToken
=
federationAuthToken
;
this
.
federationAuthToken
=
normalizeToken
(
federationAuthToken
)
;
this
.
httpWrapper
=
new
HttpWrapper
();
}
...
...
@@ -36,6 +36,13 @@ public class FogbowClient {
return
managerHost
+
":"
+
managerPort
;
}
private
static
String
normalizeToken
(
String
token
)
{
if
(
token
==
null
)
{
return
null
;
}
return
token
.
replace
(
"\n"
,
""
);
}
public
String
createRequest
(
int
minCPU
,
int
minRAM
,
String
imageName
,
String
pubKeyFilePath
,
String
localAuthToken
)
throws
Exception
{
return
createRequests
(
1
,
true
,
null
,
"Glue2vCPU >= "
+
minCPU
+
" Glue2RAM >= "
+
minRAM
,
...
...
@@ -94,7 +101,11 @@ public class FogbowClient {
RequestAttribute
.
DATA_PUBLIC_KEY
.
getValue
()
+
"="
+
pubKey
));
}
headers
.
add
(
new
BasicHeader
(
OCCIHeaders
.
X_LOCAL_AUTH_TOKEN
,
localAuthToken
));
if
(
localAuthToken
!=
null
)
{
headers
.
add
(
new
BasicHeader
(
OCCIHeaders
.
X_LOCAL_AUTH_TOKEN
,
normalizeToken
(
localAuthToken
)));
}
String
response
=
httpWrapper
.
doRequest
(
"post"
,
getManagerURL
()
+
"/"
+
RequestConstants
.
TERM
,
...
...
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