Commit 42ac6905 by Tuomas Riihimäki

Argh.. noobie error ( == when should have been .equals

1 parent 49056db1
......@@ -47,8 +47,8 @@ public class BasicAuthPBean extends ApiAuth implements AuthenticationFormat {
}
String authStr = new String(Base64.getDecoder().decode(pwdsplit[1]), UTF8);
String[] splitStr = authStr.split(PASSWORD_DELIMITER);
if (splitStr.length != 4 && splitStr[0] != PASSWORD_PREFIX) {
logger.warn(
if (splitStr.length != 4 || !PASSWORD_PREFIX.equals(splitStr[0])) {
logger.warn(
"Invalid Basic authentication string '{}'. Authstring must start with {}, followed by appid and app pass",
authStr, PASSWORD_PREFIX);
return null;
......@@ -58,7 +58,7 @@ public class BasicAuthPBean extends ApiAuth implements AuthenticationFormat {
final String appKey = splitStr[3];
ApiApplicationInstance appInstance = verifyAppInstance(appId, userId);
if (appKey != null && !appKey.isEmpty() && appKey.equals(appInstance.getSecretKey())) {
if (appInstance != null && appKey != null && !appKey.isEmpty() && appKey.equals(appInstance.getSecretKey())) {
ret.setUsername(getUsername(appInstance));
}
} catch (Exception e) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!