mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05:17:41 +03:00
Bug #839: Add support in java oca for auth tokens with protocol
(cherry picked from commit 9ee34a8b87
)
This commit is contained in:
parent
69933ac673
commit
16f173fd44
@ -158,13 +158,12 @@ public class Client{
|
||||
|
||||
String[] token = oneSecret.split(":");
|
||||
|
||||
if(token.length != 2 )
|
||||
if ( token.length > 2 )
|
||||
{
|
||||
throw new ClientConfigurationException(
|
||||
"Wrong format for authorization string: "
|
||||
+ oneSecret + "\nFormat expected is user:password");
|
||||
oneAuth = oneSecret;
|
||||
}
|
||||
|
||||
else if ( token.lenght == 2 )
|
||||
{
|
||||
MessageDigest md = MessageDigest.getInstance("SHA-1");
|
||||
byte[] digest = md.digest(token[1].getBytes());
|
||||
|
||||
@ -184,6 +183,14 @@ public class Client{
|
||||
|
||||
oneAuth = token[0] + ":" + hash;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ClientConfigurationException(
|
||||
"Wrong format for authorization string: "
|
||||
+ oneSecret + "\nFormat expected is user:password");
|
||||
}
|
||||
|
||||
}
|
||||
catch (FileNotFoundException e)
|
||||
{
|
||||
// This comes first, since it is a special case of IOException
|
||||
|
Loading…
Reference in New Issue
Block a user