Front without authentication

Hi. What should I do that my app will be able to all users? I created a polymer front client and when I go to http://localhost:8080/app-front/ I see login form and after success login I see my content . Honestly my app don’t require any authentication and I want that anonymous user will have access to everything on the frontend.

Regards,
Jey

I read about Dispatcher and I used it following https://www.cuba-platform.com/discuss/t/custom-controller-anonymous-access/3378/11. I have an access to elements from created directory “website” on http://localhost:8080/app/dispatch/. So, if I want to create website without login form on the start I should make changes in polymer.js ?

“basePath”: “/app-front/” → “basePath”: “/app-front/dispatch/”

Hi,

You can remove/move login and show app layout without authentication. Just remove the dom-if in app-shell.html: <template is="dom-if" if="[[authenticated]]" restamp="true">.

In order to work with data you can

[A] Use REST service methods which are allowed for anonymous: see anonymousAllowed="true" in services configuration

[B] Create custom rest controllers which work without authentication which is the most secure and robust way.

[C] Enable anonymous mode in REST API: Anonymous Access - CUBA Platform. Developer’s Manual

In that case you should carefully configure anonymous role (in most cases you will need to configure access group for Anonymous user as well). Also you should bear in mind that any rest service/query become available without authentication.

1 Like

Hi, thanks for the answer Vlad.

I did it as you wrote but it doesn’t work.

  1. What shoud I do remove exactly?
    from:
    <template is="dom-if" if="[[authenticated]]" restamp="true">
    to:
    <template>

  2. I have two markups “template” :

<template is="dom-if" if="[[!authenticated]]">
      <yachtrent-login on-cuba-login-success="_handleLogin">
      </yachtrent-login>
    </template>
<template is="dom-if" if="[[authenticated]]" restamp="true">
      <cuba-progress-indicator></cuba-progress-indicator>
      <app-drawer-layout id="drawerLayout" fullbleed>

So when I set the flag authenticated to !authenticated in second markup then I have an access to front website without login but if is it all? You said to delete so…

Regards

You should just remove <template is="dom-if" > tag itself (and closing tag as well </template> ). Also I forgot to mention another possibility to work with data for anonymous users: there is an anonymousAllowed="true" setting for REST service methods: Services Configuration - CUBA Platform. Developer’s Manual.

1 Like

Vlad, when i save changes with <template is="dom-if"> I have a blank white screen and don’t see menu or something

You need to remove it

1 Like