Error code 403 by Database authentication [message #1853638] |
Tue, 12 July 2022 03:18  |
Eclipse User |
|
|
|
Hi,
I have implemented Database authentication (source code s. below)
I get the exception "Service tunnel request failed with status code 403"
2022-07-12 08:55:37,751 WARN [qtp505021446-50] org.eclipse.scout.rt.shared.servicetunnel.AbstractServiceTunnel.interceptRequest(AbstractServiceTunnel.java:84) - No UserAgent set on calling context; include default in service-request - MDC[]
2022-07-12 08:55:37,773 WARN [qtp505021446-50] org.eclipse.jetty.server.HttpChannel.handleException(HttpChannel.java:806) - /auth - MDC[]
org.eclipse.scout.rt.shared.servicetunnel.http.HttpServiceTunnelException: Service tunnel request failed with status code 403 [remote-service.name=org.eclipse.scout.apps.helloscout.shared.security.ISqlAuthService, remote-service.operation=verify]
at org.eclipse.scout.rt.shared.servicetunnel.http.RemoteServiceInvocationCallable.call(RemoteServiceInvocationCallable.java:83)
the solution from
https://stackoverflow.com/questions/40914718/eclipse-scout-clean-database-authentication
and from
https://www.eclipse.org/forums/index.php/m/1805911/?srch=UiServletFilter#msg_1805911
doesnt work
Source code:
in ui.html module:
UiServletFilter.init
m_formBasedAccessController = BEANS.get(FormBasedAccessController.class).init(new FormBasedAuthConfig()
.withCredentialVerifier(BEANS.get(DataSourceCredentialVerifier.class)));
public class DataSourceCredentialVerifier implements ICredentialVerifier {
private static final Logger LOG = LoggerFactory.getLogger(DataSourceCredentialVerifier.class);
@Override
public int verify(String username, char[] password) throws IOException {
LOG.debug("verify in DataSourceCredentialVerifier. User " + username);
Subject subject = new Subject();
subject.getPrincipals().add(new SimplePrincipal("system"));
subject.setReadOnly();
RunContext runContext = RunContexts.empty();
int result = runContext.call(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
ISqlAuthService service = BEANS.get(ISqlAuthService.class);
int res = service.verify(username, password); // hier exception: Service tunnel request failed with status code 403
return res;
}
});
return AUTH_OK;
}
in shared module:
@TunnelToServer
public interface ISqlAuthService extends IService {
int verify(String username, char[] password);
}
in server module:
public class SqlAuthService implements ISqlAuthService {
@Override
public int verify(String username, char[] password) {
// verifie the user in the database
int result = ICredentialVerifier.AUTH_OK;
return result;
}
Could you please help me
Thank you
Felix
|
|
|
|
Powered by
FUDForum. Page generated in 0.23490 seconds