Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Authentication in Scout 8
Authentication in Scout 8 [message #1797704] Mon, 05 November 2018 12:56 Go to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 30
Registered: June 2014
Member
Hello,
I need help how to implement an authentication regarding a database table in scout 8, I created a table User and now I would like to enable authentication of users regarding to theire login and password stored in the table.
Kind Regards
Anis
Re: Authentication in Scout 8 [message #1797774 is a reply to message #1797704] Tue, 06 November 2018 10:01 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 30
Registered: June 2014
Member
Hello,
I succeeded implementing an authentication using this thread
https://stackoverflow.com/questions/40914718/eclipse-scout-clean-database-authentication
But I have an error showing up after login :

java.io.IOException: Failed running org.eclipse.scout.rt.ui.html.scriptprocessor.internal.impl.MinifyJsWithYui
at org.eclipse.scout.rt.ui.html.scriptprocessor.ScriptProcessor.runInClassLoader(ScriptProcessor.java:97)
at org.eclipse.scout.rt.ui.html.scriptprocessor.ScriptProcessor.minifyJs(ScriptProcessor.java:77)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.minifyContent(ScriptFileBuilder.java:346)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.compileAndMinifyContent(ScriptFileBuilder.java:327)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.processMacroWithIncludesRec(ScriptFileBuilder.java:249)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.buildScript(ScriptFileBuilder.java:117)
at org.eclipse.scout.rt.ui.html.res.loader.ScriptFileLoader.loadResource(ScriptFileLoader.java:59)
at org.eclipse.scout.rt.ui.html.res.loader.AbstractResourceLoader.loadResource(AbstractResourceLoader.java:45)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.getScriptAndFingerprint(HtmlDocumentParser.java:167)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.createExternalPath(HtmlDocumentParser.java:111)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.replaceScriptTags(HtmlDocumentParser.java:93)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.replaceScriptTags(HtmlDocumentParser.java:212)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.replaceAllTags(HtmlDocumentParser.java:81)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.parseDocument(HtmlDocumentParser.java:71)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlFileLoader.loadResource(HtmlFileLoader.java:103)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlFileLoader.loadResource(HtmlFileLoader.java:70)
at org.eclipse.scout.rt.ui.html.res.ResourceRequestHandler.resolveResourceFromCache(ResourceRequestHandler.java:124)
at org.eclipse.scout.rt.ui.html.res.ResourceRequestHandler.handleGet(ResourceRequestHandler.java:78)
at org.eclipse.scout.rt.ui.html.AbstractUiServletRequestHandler.handle(AbstractUiServletRequestHandler.java:26)
at org.eclipse.scout.rt.ui.html.UiServlet.handleRequestInternal(UiServlet.java:255)
at org.eclipse.scout.rt.ui.html.UiServlet.lambda$0(UiServlet.java:219)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:227)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequiresNew(TransactionProcessor.java:100)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:129)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:71)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:222)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:170)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:156)
at org.eclipse.scout.rt.ui.html.UiServlet.handleRequest(UiServlet.java:219)
at org.eclipse.scout.rt.ui.html.UiServlet.doGet(UiServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at org.eclipse.scout.rt.server.commons.servlet.AbstractHttpServlet.access$0(AbstractHttpServlet.java:1)
at org.eclipse.scout.rt.server.commons.servlet.AbstractHttpServlet.wrap(AbstractHttpServlet.java:49)
at org.eclipse.scout.rt.server.commons.servlet.AbstractHttpServlet.service(AbstractHttpServlet.java:38)
at org.eclipse.scout.rt.ui.html.UiServlet.service(UiServlet.java:141)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.scout.rt.server.commons.servlet.filter.gzip.GzipServletFilter.doFilter(GzipServletFilter.java:84)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at org.eclipse.scout.rt.server.commons.authentication.ServletFilterHelper.lambda$0(ServletFilterHelper.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.eclipse.scout.rt.server.commons.authentication.ServletFilterHelper.continueChainAsSubject(ServletFilterHelper.java:155)
at org.eclipse.scout.rt.server.commons.authentication.TrivialAccessController.handleRequest(TrivialAccessController.java:103)
at org.eclipse.scout.rt.server.commons.authentication.TrivialAccessController.handle(TrivialAccessController.java:78)

I do not know how to deal with it, can any one help ?
Re: Authentication in Scout 8 [message #1797777 is a reply to message #1797774] Tue, 06 November 2018 10:27 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Hi Anis

Is there a Nested exception or is this the whole stack trace?

Otherwise, to debug, set a breakpoint in the method
org.eclipse.scout.rt.ui.html.scriptprocessor.ScriptProcessor.runInClassLoader(ClassLoader, String, Class<?>[], Object[])
If an exception occurs there, please try to output the original exception that was thrown (it may be wrapped in the thrown exception) and post that here.
Re: Authentication in Scout 8 [message #1797789 is a reply to message #1797777] Tue, 06 November 2018 12:35 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 30
Registered: June 2014
Member
Hello,
this is the hole error stuck,

MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: invalid property id
MinifyJsWithYui error: missing ; before statement
MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: invalid property id
MinifyJsWithYui error: Compilation produced 7 syntax errors.
2018-11-06 13:32:51,238 ERROR [qtp929383713-20] org.eclipse.scout.rt.ui.html.UiServlet.handleRequestInternal(UiServlet.java:262) - Exception while processing request - MDC[principal=admin, cid=9be92fc2-5e86-47d8-9d33-4da5f510630f]
java.io.IOException: Failed running org.eclipse.scout.rt.ui.html.scriptprocessor.internal.impl.MinifyJsWithYui
at org.eclipse.scout.rt.ui.html.scriptprocessor.ScriptProcessor.runInClassLoader(ScriptProcessor.java:97)
at org.eclipse.scout.rt.ui.html.scriptprocessor.ScriptProcessor.minifyJs(ScriptProcessor.java:77)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.minifyContent(ScriptFileBuilder.java:346)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.compileAndMinifyContent(ScriptFileBuilder.java:327)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.processMacroWithIncludesRec(ScriptFileBuilder.java:249)
at org.eclipse.scout.rt.ui.html.script.ScriptFileBuilder.buildScript(ScriptFileBuilder.java:117)
at org.eclipse.scout.rt.ui.html.res.loader.ScriptFileLoader.loadResource(ScriptFileLoader.java:59)
at org.eclipse.scout.rt.ui.html.res.loader.AbstractResourceLoader.loadResource(AbstractResourceLoader.java:45)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.getScriptAndFingerprint(HtmlDocumentParser.java:167)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.createExternalPath(HtmlDocumentParser.java:111)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.replaceScriptTags(HtmlDocumentParser.java:93)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.replaceScriptTags(HtmlDocumentParser.java:212)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.replaceAllTags(HtmlDocumentParser.java:81)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlDocumentParser.parseDocument(HtmlDocumentParser.java:71)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlFileLoader.loadResource(HtmlFileLoader.java:103)
at org.eclipse.scout.rt.ui.html.res.loader.HtmlFileLoader.loadResource(HtmlFileLoader.java:70)
at org.eclipse.scout.rt.ui.html.res.ResourceRequestHandler.resolveResourceFromCache(ResourceRequestHandler.java:124)
at org.eclipse.scout.rt.ui.html.res.ResourceRequestHandler.handleGet(ResourceRequestHandler.java:78)
at org.eclipse.scout.rt.ui.html.AbstractUiServletRequestHandler.handle(AbstractUiServletRequestHandler.java:26)
at org.eclipse.scout.rt.ui.html.UiServlet.handleRequestInternal(UiServlet.java:255)
at org.eclipse.scout.rt.ui.html.UiServlet.lambda$0(UiServlet.java:219)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:227)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequiresNew(TransactionProcessor.java:100)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.runTxRequired(TransactionProcessor.java:129)
at org.eclipse.scout.rt.platform.transaction.TransactionProcessor.intercept(TransactionProcessor.java:71)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain$Chain.continueChain(CallableChain.java:222)
at org.eclipse.scout.rt.platform.chain.callable.CallableChain.call(CallableChain.java:170)
at org.eclipse.scout.rt.platform.context.RunContext.call(RunContext.java:156)
at org.eclipse.scout.rt.ui.html.UiServlet.handleRequest(UiServlet.java:219)
at org.eclipse.scout.rt.ui.html.UiServlet.doGet(UiServlet.java:152)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
at org.eclipse.scout.rt.server.commons.servlet.AbstractHttpServlet.access$0(AbstractHttpServlet.java:1)
at org.eclipse.scout.rt.server.commons.servlet.AbstractHttpServlet.wrap(AbstractHttpServlet.java:49)
at org.eclipse.scout.rt.server.commons.servlet.AbstractHttpServlet.service(AbstractHttpServlet.java:38)
at org.eclipse.scout.rt.ui.html.UiServlet.service(UiServlet.java:141)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
at org.eclipse.scout.rt.server.commons.servlet.filter.gzip.GzipServletFilter.doFilter(GzipServletFilter.java:84)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1621)
at org.eclipse.scout.rt.server.commons.authentication.ServletFilterHelper.lambda$0(ServletFilterHelper.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.eclipse.scout.rt.server.commons.authentication.ServletFilterHelper.continueChainAsSubject(ServletFilterHelper.java:155)
at org.eclipse.scout.rt.server.commons.authentication.TrivialAccessController.handleRequest(TrivialAccessController.java:103)
at org.eclipse.scout.rt.server.commons.authentication.TrivialAccessController.handle(TrivialAccessController.java:78)
at com.anis.recovery.app.recovery.ui.html.UiServletFilter.doFilter(UiServletFilter.java:52)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1613)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:541)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1593)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1239)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:481)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1562)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1141)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:564)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.eclipse.scout.rt.ui.html.scriptprocessor.ScriptProcessor.runInClassLoader(ScriptProcessor.java:89)
... 71 common frames omitted
Caused by: java.lang.NullPointerException: null
at org.mozilla.javascript.Parser.parse(Parser.java:396)
at org.mozilla.javascript.Parser.parse(Parser.java:340)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:314)
at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:539)
at org.eclipse.scout.rt.ui.html.scriptprocessor.internal.impl.MinifyJsWithYui.run(MinifyJsWithYui.java:52)
... 76 common frames omitted

I changed the UiSerfletFilter to implement database authentication process throw a service that compare the user and login and see if they exist in the database.
what is the

MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: invalid property id
MinifyJsWithYui error: missing ; before statement
MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: missing name after . operator
MinifyJsWithYui error: invalid property id
MinifyJsWithYui error: Compilation produced 7 syntax errors.

?
Re: Authentication in Scout 8 [message #1797793 is a reply to message #1797789] Tue, 06 November 2018 13:02 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Ok, you run into two issues here:
1) A bug which gives you the NullPointerException (instead of a nice message) if the Compressor finds a syntax error. This might already be fixed for the next version of Scout: https://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/commit/?id=621cf73476c0f581752fde4752f1a0cbd88e0a29
2) A compilation error of the Javascript.

The second one is likely an issue of custom Javascript - have you written any custom javascript code? Check it for syntax errors, if possible, see the MinifyJsWithYui errors for hints. Using the breakpoint from before might help you in identifying which file is the cause.

You can also (temporarily) disable the minifying by passing the URL Hint "debug=true" (example: http://localhost:8082/?debug=true ). If an error exists, it will still show up when you try to run it, but your browser might make it easier to pinpoint.
(This only works if the "scout.urlHints.enabled" property is enabled. This property is enabled by default in development mode which typically is set using 'scout.devMode' in Eclipse Launch files.)
Re: Authentication in Scout 8 [message #1797803 is a reply to message #1797793] Tue, 06 November 2018 14:52 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 30
Registered: June 2014
Member
Hello,
I did not changed any javascript, this what I done,
I wanted to implement a database authentication
you know that eclipse scout project are automaticly created against the config.ini file authentication, this is implemented in the UiServletFilter class
@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		m_trivialAccessController = BEANS.get(TrivialAccessController.class).init(new TrivialAuthConfig()
				.withExclusionFilter(filterConfig.getInitParameter("filter-exclude")).withLoginPageInstalled(true));
		m_formBasedAccessController = BEANS.get(FormBasedAccessController.class)
				.init(new FormBasedAuthConfig().withCredentialVerifier(BEANS.get(ConfigFileCredentialVerifier.class)));
		m_developmentAccessController = BEANS.get(DevelopmentAccessController.class).init();
	}



I changed it to :

@Override
	public void init(FilterConfig filterConfig) throws ServletException {
		m_trivialAccessController = BEANS.get(TrivialAccessController.class).init(new TrivialAuthConfig()
				.withExclusionFilter(filterConfig.getInitParameter("filter-exclude")).withLoginPageInstalled(true));
		m_formBasedAccessController = BEANS.get(FormBasedAccessController.class)
				.init(new FormBasedAuthConfig().withCredentialVerifier(BEANS.get(DataSourceCredentialVerifier.class)));
		m_developmentAccessController = BEANS.get(DevelopmentAccessController.class).init();
	}


This class contain a methode named verify

	@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();
		Object[][] result = runContext.call(new Callable<Object[][]>() {

			@Override
			public Object[][] call() throws Exception {
				return BEANS.get(IDBAuthService.class).load(username, password);

			}

		});
		if (result.length > 0)
			return AUTH_OK;
		else
			return AUTH_FAILED;
	}


that uses a service IDBAuthenService that will perform a query in the database base on the login and password provided in the login form,
the login is correct , I mean it return AUTH_OK then it runs in the previously mentioned error.
and even when using the ConfigFileCredentialVerifier I have the same error !!
So I am missing a peace in the implementation of the authentication ;..
Re: Authentication in Scout 8 [message #1797809 is a reply to message #1797803] Tue, 06 November 2018 16:45 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Ok, that looks fine to me - especially if it happens with the original credential verifier as well.

Could you try this short fix if it resolves the symptoms?
1. Clean and rebuild the "... ui.html" and "ui.html.dev" projects of yours (Eclipse: ALT + F5, Choose "Clean projects" and "Update snapshots and releases" additionally, leave the other defaults)
2. Restart the application
3. Reload the browser (F5) before trying to login
Re: Authentication in Scout 8 [message #1798106 is a reply to message #1797809] Mon, 12 November 2018 15:10 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 30
Registered: June 2014
Member
Hello,
I found out the problem it was related to the js used for the chats component, when I removed them I was I able to make the authentication to the DB, I do not know what is the relation between them but I am analyzing it deeper.
Kind Regards
Re: Authentication in Scout 8 [message #1805911 is a reply to message #1798106] Sat, 27 April 2019 18:34 Go to previous messageGo to next message
Krzysztof Leja is currently offline Krzysztof LejaFriend
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

Re: Authentication in Scout 8 [message #1805974 is a reply to message #1805911] Mon, 29 April 2019 14:28 Go to previous messageGo to next message
Patrick Bänziger is currently offline Patrick BänzigerFriend
Messages: 90
Registered: September 2011
Member
Hi Krzysztof

Your interface is not extending the interface org.eclipse.scout.rt.platform.service.IService.
Because of this, your service won't be recognized as a Scout Bean (because it doesn't inherit the annotation from the mentioned interface) and won't be found by the indexer - leading to the exception above.

Just change your interface to this

public interface ISqlAuthService extends IService { 


and you should be in business!
Re: Authentication in Scout 8 [message #1806466 is a reply to message #1805974] Thu, 09 May 2019 12:55 Go to previous messageGo to next message
Krzysztof Leja is currently offline Krzysztof LejaFriend
Messages: 26
Registered: April 2019
Junior Member
Hi Patrick,
Thank you. It helped. Somehow I missed the inheritance of this interface.

PS. In the meantime, I found another alternative solution that also worked: adding the @Bean annotation to the class definition implementing my ISqlAuthService interface
Re: Authentication in Scout 8 [message #1806519 is a reply to message #1806466] Fri, 10 May 2019 06:44 Go to previous messageGo to next message
Matthias Villiger is currently offline Matthias VilligerFriend
Messages: 153
Registered: September 2011
Senior Member
Hi Krzysztof

You are right: Adding the @Bean annotation has a similar effect.
But please note that there is a difference: With IService you inherit the @ApplicationScoped annotation. This is a bean too but it means there will be always only one instance per Scout application. You can think of it as a kind of singleton.
While the @Bean annotation means that there might be multiple instances and each BEANS.get() will create a new one!
Usually for stateless services @ApplicationScoped is the better option.

Please see the technical documentation for details about bean scopes

Re: Authentication in Scout 8 [message #1806521 is a reply to message #1806519] Fri, 10 May 2019 06:57 Go to previous message
Krzysztof Leja is currently offline Krzysztof LejaFriend
Messages: 26
Registered: April 2019
Junior Member
Hi Matthias,
Thank you for the detailed, very helpful explanation.
Previous Topic:Viewing/rendering PDF file
Next Topic:Rich content in desktop notifications
Goto Forum:
  


Current Time: Wed Nov 13 09:57:47 GMT 2019

Powered by FUDForum. Page generated in 0.02011 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top