|
|
|
|
|
|
|
|
Re: Authentication in Scout 8 [message #1805911 is a reply to message #1798106] |
Sat, 27 April 2019 18:34   |
Krzysztof Leja Messages: 26 Registered: April 2019 |
Junior Member |
|
|
Hi,
I have the same case as in this thread: I would like to implement the authentication of users logging in to my application (using the Scout 9 version), with the participation of a dedicated table in the database.
Using all the tips given here, I made the following changes:
1. In the "shared" module I added a new authorization interface, as follows:
@TunnelToServer
public interface ISqlAuthService {
public int verify(String username, char[] password);
}
2. In the "server" module, I added the implementation of this interface, which verifies the user in the database.
3. In the "client" module I added the implementation of the ICredentialVerifier interface, which calls the above-mentioned service, as follows:
public class DataSourceCredentialVerifier implements ICredentialVerifier {
@Override
public int verify(String username, char[] password) throws IOException {
Subject subject = new Subject();
subject.getPrincipals().add(new SimplePrincipal("system"));
subject.setReadOnly();
RunContext runContext = RunContexts.empty();
return runContext.call(new Callable<Integer>() {
@Override
public Integer call() throws Exception {
return BEANS.get(ISqlAuthService.class).verify(username, password);
}
});
}
}
4. In the "ui.html" module in the existing UiServletFilter class I have added a reference to the above mentioned DataSourceCredentialVerifier.
When I run my application in development mode (ie through modules * .app.dev) and then submit login form, I get this exception:
Quote:
org.eclipse.scout.rt.platform.exception.ExceptionHandler.handleThrowable(ExceptionHandler.java:135) - SecurityException:service registry does not contain a service of type pl.myapps.helloword.shared.security.ISqlAuthService - MDC[principal=KL, cid=937b2ab9-76bb-4751-8b4c-0907daec1b39]
java.lang.SecurityException: service registry does not contain a service of type pl.myapps.helloword.shared.security.ISqlAuthService
What else do I need to do to make it work?
[Updated on: Sat, 27 April 2019 18:51] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02775 seconds