GUACAMOLE-362: Fix case where credential object is null.

This commit is contained in:
Nick Couchman authored and Nick Couchman committed 2017-10-27 13:05:12 -04:00
1 parent 1c4831dd51
commit 1c333106c0
1 file changed
+6 -3
@@ -109,9 +109,12 @@ public class AuthenticationProviderService {
AttributePrincipal principal = ticketService.validateTicket(ticket);
String username = principal.getName();
credentials.setUsername(username);
String clearPass = decryptPassword(principal.getAttributes().get("credential").toString());
if (clearPass != null && !clearPass.isEmpty())
credentials.setPassword(clearPass);
Object credObj = principal.getAttributes().get("credential");
if (credObj != null) {
String clearPass = decryptPassword(credObj.toString());
if (clearPass != null && !clearPass.isEmpty())
credentials.setPassword(clearPass);
}
authenticatedUser.init(username, credentials);
return authenticatedUser;
}