Source:
<code>public BridgeUser authenticate(Authentication authentication) throws AuthenticationFailedException { if (StorageUtils.LOG.isFINE()) { StorageUtils.LOG.FINE("Layer 3/FTP: Incoming auth-request: " + authentication); } if (!(authentication instanceof UsernamePasswordAuthentication)) { StorageUtils.LOG.FINE("Layer 3/FTP: Not a UsernamePasswordAuthentication...aborting"); throw new AuthenticationFailedException("Please use username/password to authenticate."); } UsernamePasswordAuthentication auth = (UsernamePasswordAuthentication) authentication; StorageUtils.LOG.FINE("Layer 3/FTP: Trying to authenticate user: " + auth.getUsername()); String username = auth.getUsername(); if (username.contains("\\") && detector != null) { Tuple<String, String> scopeAndUsername = Strings.split(username, "\\"); UserContext.get().setCurrentScope(detector.findScopeByName(scopeAndUsername.getFirst())); username = scopeAndUsername.getSecond(); } boolean locked = UserContext.getCurrentScope().tryAs(MaintenanceInfo.class).map(MaintenanceInfo::isLocked).orElse(false); if (locked) { throw new AuthenticationFailedException("The system is currently locked for maintenance reasons."); } try { String effectiveUserName = username.replace("_AT_", "@"); UserInfo authUser = UserContext.get() .getUserManager() .findUserByCredentials(null, effectiveUserName, auth.getPassword()); if (authUser == null) { StorageUtils.LOG.FINE("Layer 3/FTP: Invalid credentails..."); throw new AuthenticationFailedException("Invalid credentials."); } if (!authUser.isSubScopeEnabled(VirtualFileSystem.SUB_SCOPE_VFS)) { <START> throw new AuthenticationFailedException("The required sub scope is not enabled for this use."); <END> } StorageUtils.LOG.FINE("Layer 3/FTP: User is authorized..."); return new BridgeUser(authUser, UserContext.getCurrentScope().getScopeId()); } catch (Exception e) { throw new AuthenticationFailedException(e.getMessage()); } }</code><technical_language>suggestion throw new AuthenticationFailedException("The required scope is enabled for this user.");</technical_language>

Target:
public BridgeUser authenticate(Authentication authentication) throws AuthenticationFailedException { if (StorageUtils.LOG.isFINE()) { StorageUtils.LOG.FINE("Layer 3/FTP: Incoming auth-request: " + authentication); } if (!(authentication instanceof UsernamePasswordAuthentication)) { StorageUtils.LOG.FINE("Layer 3/FTP: Not a UsernamePasswordAuthentication...aborting"); throw new AuthenticationFailedException("Please use username/password to authenticate."); } UsernamePasswordAuthentication auth = (UsernamePasswordAuthentication) authentication; StorageUtils.LOG.FINE("Layer 3/FTP: Trying to authenticate user: " + auth.getUsername()); String username = auth.getUsername(); if (username.contains("\\") && detector != null) { Tuple<String, String> scopeAndUsername = Strings.split(username, "\\"); UserContext.get().setCurrentScope(detector.findScopeByName(scopeAndUsername.getFirst())); username = scopeAndUsername.getSecond(); } boolean locked = UserContext.getCurrentScope().tryAs(MaintenanceInfo.class).map(MaintenanceInfo::isLocked).orElse(false); if (locked) { throw new AuthenticationFailedException("The system is currently locked for maintenance reasons."); } try { String effectiveUserName = username.replace("_AT_", "@"); UserInfo authUser = UserContext.get() .getUserManager() .findUserByCredentials(null, effectiveUserName, auth.getPassword()); if (authUser == null) { StorageUtils.LOG.FINE("Layer 3/FTP: Invalid credentails..."); throw new AuthenticationFailedException("Invalid credentials."); } if (!authUser.isSubScopeEnabled(VirtualFileSystem.SUB_SCOPE_VFS)) { throw new AuthenticationFailedException("The required sub scope is not enabled for this user."); } StorageUtils.LOG.FINE("Layer 3/FTP: User is authorized..."); return new BridgeUser(authUser, UserContext.getCurrentScope().getScopeId()); } catch (Exception e) { throw new AuthenticationFailedException(e.getMessage()); } }