Topic
  • 4 replies
  • Latest Post - ‏2012-10-04T17:16:44Z by qcduong
SystemAdmin
SystemAdmin
300 Posts

Pinned topic protecting Worklight console does not work in version 5.0.0.3

‏2012-09-20T08:44:23Z |
Hi,
Procedure for protecting Worklight console does not work on version 5.0.0.3
When I uncomment the element to protect the worklight console in authenticationConfig.xml and set up console.username and console.password in worklight.properties file I have received exception:
Exception thrown by application class 'com.worklight.core.auth.impl.AuthenticationContext.getOrCreateAuthenticationContext():101'
null
at com.worklight.core.auth.impl.AuthenticationContext.getOrCreateAuthenticationContext(AuthenticationContext.java:101)
at com.worklight.core.auth.impl.AuthenticationFilter.doFilter(AuthenticationFilter.java:92)
Obviously something has changed and this is probably connected to improvements in authentication framework. What is the procedure for protecting console now?
Thanks,
Jelena
  • IdanAdar
    IdanAdar
    49 Posts

    Re: protecting Worklight console does not work in version 5.0.0.3

    ‏2012-09-24T06:30:26Z  
    Is this with a new project in v5.0.0.3 or with an already existing project?

    In authenticationConfig.xml, the following is stated:
    <!-- Uncomment the next element to protect the worklight console and the first section in securityTests below. -->

    Have you uncommented the first element in the securityTests section?
    I don't see you mentioning this the provided log snippets...

    You need the following set in authenticationConfig.xml:
    <staticResources>
    <resource id="worklightConsole" securityTest="WorklightConsole">
    <urlPatterns>/console*</urlPatterns>
    </resource>
    </staticResources>

    <securityTests>
    <customSecurityTest name="WorklightConsole">
    <test realm="WorklightConsole" isInternalUserID="true"/>
    </customSecurityTest>
    </securityTests>
    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
  • SystemAdmin
    SystemAdmin
    300 Posts

    Re: protecting Worklight console does not work in version 5.0.0.3

    ‏2012-09-24T09:30:31Z  
    • IdanAdar
    • ‏2012-09-24T06:30:26Z
    Is this with a new project in v5.0.0.3 or with an already existing project?

    In authenticationConfig.xml, the following is stated:
    <!-- Uncomment the next element to protect the worklight console and the first section in securityTests below. -->

    Have you uncommented the first element in the securityTests section?
    I don't see you mentioning this the provided log snippets...

    You need the following set in authenticationConfig.xml:
    <staticResources>
    <resource id="worklightConsole" securityTest="WorklightConsole">
    <urlPatterns>/console*</urlPatterns>
    </resource>
    </staticResources>

    <securityTests>
    <customSecurityTest name="WorklightConsole">
    <test realm="WorklightConsole" isInternalUserID="true"/>
    </customSecurityTest>
    </securityTests>
    Idan Adar
    QA Engineer
    IBM Worklight Mobile Platform
    it is fresh worklight server installation 5.0.0.3 (Liberty & Derby).
    It is not project, I have changed worklight.war on server according the procedure.
    As I mentioned in previous post I have uncomment element in authenticationConfig. In attachment you can find authenticationConfig.
    Thanks,
    Jelena
  • SystemAdmin
    SystemAdmin
    300 Posts

    Re: protecting Worklight console does not work in version 5.0.0.3

    ‏2012-10-03T16:13:34Z  
    Hi,

    I see your xml doesn't match the sample xml in the Developer Reference Guide.
    The reference guide has this entry:
    <parameter name="login-page" value="login.html"/>
    on the realm. Perhaps this is the reason?

    <realms>
    <realm name="WorkLightConsole" loginModule="requireLogin">
    <className> com.worklight.core.auth.ext.FormBasedAuthenticator
    </className>
    <parameter name="login-page" value="login.html"/>
    <onLoginUrl> /console </onLoginUrl>
    </realm>
    </realms>

    James
  • qcduong
    qcduong
    12 Posts

    Re: protecting Worklight console does not work in version 5.0.0.3

    ‏2012-10-04T17:16:44Z  
    it is fresh worklight server installation 5.0.0.3 (Liberty & Derby).
    It is not project, I have changed worklight.war on server according the procedure.
    As I mentioned in previous post I have uncomment element in authenticationConfig. In attachment you can find authenticationConfig.
    Thanks,
    Jelena
    Hi,

    Here is what you can try, I have just tested it successfully.

    Instead of uncommenting the default section:
    ****original*****
    <!-- staticResources>
    <resource id="worklightConsole">
    <urlPatterns>/console*</urlPatterns>
    <resourceRealm>WorklightConsole</resourceRealm>
    </resource>
    </staticResources-->
    ****/original*****

    ***use***
    <staticResources>
    <resource id="worklightConsole" securityTest="WorklightConsole">
    <urlPatterns>/console*</urlPatterns>
    </resource>
    </staticResources>

    <securityTests>
    <customSecurityTest name="WorklightConsole">
    <test realm="WorklightConsole" isInternalUserID="true"/>
    </customSecurityTest>
    </securityTests>

    ***/use***
    update worklight.properties accordingly for the console.username and console.password

    I will create a defect for this, can you let me know if what I suggests works for you?