@Rajith
You can use {{secure}} tag at the top of the page to indicate that it's a
login required page.
Unfortunately this is not documented yet, AFAIK.
@UUF team
Agree with Sajith, this need to be addressed by UUF auth
But,
1.
We already have a {{secure}} helper but nobody seems to know that. Need
to get documented.
2.
As I pointed in above [1] thread, auth has to happen at UUF layer rather
than MS4J layer, because only at UUF layer we know if it needs auth at all.
Right now UUF page loads in browser is as fast as a single page app,
because non-auth resource are 100% cached, but we will lose that otherwise.
On Sun, Feb 5, 2017 at 12:28 PM, SajithAR Ariyarathna <[email protected]>
wrote:
> Rajitha's query is not about sharing common JS logic, rather he wants a
> custom authenticator to UUF.
>
> IMO, "pluggable custom authenticators" is a missing feature in UUF. IS
> guys needs need the same thing and they have proposed to use MSF4J
> interceptors [1]. We need to come-up with a better solution than that.
>
> [1] [Architecture][UUF] Pluggable Authentication mechanism for UUF
>
> Thanks.
>
> On Sun, Feb 5, 2017 at 4:28 PM, Rajith Roshan <[email protected]> wrote:
>
>> Hi Shan,
>>
>> Thanks for your prompt response. This works fine. But my actual
>> requirement is not calling the method in module inside from each and every
>> js file (pages/index.js or pages/create.js and etc). A person who writing a
>> new page will have to call this method in the module in his JS file. If
>> he/her misses this logic then validating cookie for that page will be
>> missed. Is there any common place we can do this so this method will be
>> invoked for each onGet and onPost automatically rather than specifying it
>> in individual files.
>> If there is no other way would you recommend for us to call the module
>> inside each and every onGet/onPost method?
>>
>> Thanks!
>> Rajith
>>
>> On Sun, Feb 5, 2017 at 1:14 PM, Shan Mahanama <[email protected]> wrote:
>>
>>> Hi Rajith,
>>>
>>> We can use modules for reusable js codes. Please refer modules sample in
>>> the Features app[1]. So in your case, I think we can add the *onGet*
>>> function to a module since it is reusable and include that module in all
>>> the js files where you want to perform this check.
>>>
>>> [1] https://github.com/wso2/carbon-uuf/blob/master/samples/a
>>> pps/org.wso2.carbon.uuf.sample.features-app.app/src/main/pag
>>> es/include-module.hbs
>>>
>>> Thanks,
>>> Shan.
>>>
>>>
>>> On Sun, Feb 5, 2017 at 12:14 PM, Rajith Roshan <[email protected]> wrote:
>>>
>>>> Hi Devs,
>>>>
>>>> I have written a logic to check for a cookie[1] when /publisher context
>>>> is requested. It will hit the OnGet method of index.js of publisher app.
>>>> But I need to perform this logic for all requests like /publisher/apis,
>>>> /publisher/create and etc. I can not copy the same logic to all js files.
>>>> Is there a common place in UUF where we can handle this kind of
>>>> scenario using back end Javascript.
>>>>
>>>> [1] - function onGet(env) {
>>>>
>>>> if(!env.request.getCookieValue("token1")) {
>>>> sendRedirect("commons/login");
>>>> }
>>>> sendRedirect("apis");
>>>> }
>>>>
>>>>
>>>> Thanks!
>>>> Rajith
>>>>
>>>>
>>>> Rajith Roshan
>>>> Software Engineer, WSO2 Inc.
>>>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>>>
>>>
>>>
>>>
>>> --
>>> Shan Mahanama
>>>
>>> Software Engineer, WSO2 Inc. http://wso2.com
>>> <http://l.facebook.com/l.php?u=http%3A%2F%2Fwso2.com&h=gAQEswASa>
>>> Email: [email protected]
>>> Mobile: +94 71 2000 498
>>>
>>>
>>>
>>
>>
>> --
>> Rajith Roshan
>> Software Engineer, WSO2 Inc.
>> Mobile: +94-72-642-8350 <%2B94-71-554-8430>
>>
>
>
>
> --
> Sajith Janaprasad Ariyarathna
> Software Engineer; WSO2, Inc.; http://wso2.com/
> <https://wso2.com/signature>
>
--
With regards,
*Manu*ranga Perera.
phone : 071 7 70 20 50
mail : [email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev