You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Albert J Carter-Corbin (Jira)" <ji...@apache.org> on 2021/01/27 18:33:00 UTC

[jira] [Commented] (OFBIZ-12160) Cannot authentication with ofbiz-rest-impl with multi-tenant enabled

    [ https://issues.apache.org/jira/browse/OFBIZ-12160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273076#comment-17273076 ] 

Albert J Carter-Corbin commented on OFBIZ-12160:
------------------------------------------------

I created a contextfilter in the ofbiz-rest-impl plugin which seems to have solved my problem.

From what I can see the default delegator is the only one that is being loaded which means the services that are run are running under the assumption that the install is not multitenant.

I basically copied the ContextFilter from the ofbiz-framework to initialize the multi-tenant config, delegator and dispatcher.  

I think the main part that caused the rest services to work is the delegator being associated with the correct tenant.

Previously the delegator and dispatcher names were set to default and ofbiz-rest-jersey (respectively) now, with the new contextfilter the names of both are default#tenantid and ofbiz-rest-jersey#tenantid.

Not sure if this is an appropriate fix or not. 

> Cannot authentication with ofbiz-rest-impl with multi-tenant enabled 
> ---------------------------------------------------------------------
>
>                 Key: OFBIZ-12160
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12160
>             Project: OFBiz
>          Issue Type: Bug
>          Components: rest
>    Affects Versions: Trunk
>         Environment: CentOS Linux 8 Core
> ofbiz-framework trunk branch (01/23/2021)
> ofbix-rest-impl trunk branch (01/23/2021)
> OpenJDK 1.9.0_262 64 Bit
> Running behind Apache HTTPd with Tomcat 9 and mod_jk
>            Reporter: Albert J Carter-Corbin
>            Priority: Minor
>
> Authentication works fine with all web applications, but when attempting to authenticate with the ofbiz-rest-impl plugin the following log message is displayed:
> {code:java}
> 2021-01-24 18:13:40,482 |27.0.0.1-9009-exec-3 |LoginServices |I| [LoginServices.userLogin] Invalid User : 'cartercorbin-admin'; User not found.
> 2021-01-24 18:13:40,482 |27.0.0.1-9009-exec-3 |ServiceDispatcher |W| Service Failure [userLogin]: User not found.
> 2021-01-24 18:13:40,483 |27.0.0.1-9009-exec-3 |ServiceDispatcher |T| Sync service [ofbiz-rest-jersey/userLogin] finished in [3] milliseconds
> 2021-01-24 18:13:40,483 |27.0.0.1-9009-exec-3 |HttpBasicAuthFilter |E| User not found.
> {code}
> The multi-tenant sites appear to work fine with.
> I modified the LoginService.java to verify what i was seeing:
> {code:java}
> userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne(); {code}
> To the following
> {code}
> List<GenericValue> userLogins = EntityQuery.use(delegator).from("UserLogin").queryList();
> if(ObjectUtils.isNotEmpty(userLogins)) {
> Debug.logError(String.format("Login Count: %s", userLogins.size()), MODULE);
> }
> userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", username).cache(isServiceAuth).queryOne(); {code}
> {code}
> And found that when authenticating with the plugin the userLogins was empty.  THe logins are not empty when logging into the various websites in ofbiz.  This had worked a last month before I updated pulled the latest updates.  
> I used the https://localhost:443/rest/ as the starting point.  I am very interested in using and extending the various endpoints in ofbiz.  I actually already started to expose ui services to be used in another ui framework.  I would love to be able to continue. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)