Add check for legality of the returned Matrix ID in Auth
- Helps troubleshoot reported issues that might not be obvious at first - Add basic unit test for auth manager
This commit is contained in:
@@ -64,6 +64,8 @@ import java.util.Objects;
|
||||
|
||||
public class AuthManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(AuthManager.class);
|
||||
|
||||
private static final String TypeKey = "type";
|
||||
private static final String UserKey = "user";
|
||||
private static final String IdentifierKey = "identifier";
|
||||
@@ -72,7 +74,6 @@ public class AuthManager {
|
||||
private static final String UserIdTypeValue = "m.id.user";
|
||||
private static final String ThreepidTypeValue = "m.id.thirdparty";
|
||||
|
||||
private transient final Logger log = LoggerFactory.getLogger(AuthManager.class);
|
||||
private final Gson gson = GsonUtil.get(); // FIXME replace
|
||||
|
||||
private List<AuthenticatorProvider> providers;
|
||||
@@ -138,6 +139,12 @@ public class AuthManager {
|
||||
invMgr.publishMappingIfInvited(new ThreePidMapping(pid, mxId));
|
||||
}
|
||||
|
||||
try {
|
||||
MatrixID.asValid(mxId);
|
||||
} catch (IllegalArgumentException e) {
|
||||
log.warn("The returned User ID {} is not a valid Matrix ID. Login might fail at the Homeserver level", mxId);
|
||||
}
|
||||
|
||||
invMgr.lookupMappingsForInvites();
|
||||
|
||||
return authResult;
|
||||
|
||||
Reference in New Issue
Block a user