penpot icon indicating copy to clipboard operation
penpot copied to clipboard

feature: Auto-Login with OpenID

Open fullheart opened this issue 3 years ago • 6 comments

Is your feature request related to a problem? Please describe.

At the moment we need a extra click to login with an OpenID Provider by clicking on Button OpenID. This extra click is not needed, when this feature request get implemented.

Describe the solution you'd like.

To speed-up the login process with an OpenID Provider, it would be create to activate auto-login with a new env variable. With this approach users must not click extra on OpenId Button.

A great reference to implement this feature, is the implementation in the open source project BookStack: https://www.bookstackapp.com/docs/admin/oidc-auth/ . They provide a AUTH_AUTO_INITIATE env variable. When this variable is set to true, the login process automatically starts, when login page is visited.

Describe alternatives you've considered.

I workaround this missing features in our organisation by "hacking" the docker container like that:

custom_config.js

var penpotFlags = "[OUR_PENPOT_FLAGS]"

function waitUntilDomAvailable(selector, callback) {
    const domNode = document.querySelector(selector)
    if (!domNode) {
        setTimeout(function() {
            waitUntilDomAvailable(selector, callback)
        }, 200)
    } else {
        callback(domNode)
    }
}
const buttonSelector = ".auth-buttons a.btn-primary"
waitUntilDomAvailable(buttonSelector, function(button) {
    const isRedirectionFromLogout = document.referrer === '[OUR_PENPOT_DOMAIN]'
    if (!isRedirectionFromLogout) {
        // Auto login
        button.click()
        button.setAttribute('disabled', 'disabled');
    }
})

docker-compose.yml

---
version: "3.5"

networks:
  penpot:

services:
  penpot-frontend:
    image: "penpotapp/frontend:latest"
    [...]

    volumes:
      [...]
      - type: bind
        source: ./custom_config.js
        target: /var/www/app/js/config.js
[...]

Additional context

No response

fullheart avatar Nov 04 '22 16:11 fullheart

Looks interesting, thanks.

niwinz avatar Nov 07 '22 07:11 niwinz

Great! Here some further information how BookStack implemented this feature (mentioned open-source project in description):

  • They showing on the login screen this text + graphic (animated), that user know automatically login is started (textes are here in german, because this instance is for german users: see Screenshot )
  • When logout happen they (BookStack) add a prevent_auto_init GET param that prevent auto login (Example: https://DOMAOIN/login?prevent_auto_init=true). In this case only the Login button with OpenID is visible ( see Screenshot )

fullheart avatar Nov 08 '22 14:11 fullheart

Closing due to inactivity. Please reopen it if necessary.

hirunatan avatar Apr 25 '23 13:04 hirunatan

Hi @hirunatan

Please re-open this issue, because this feature is still missing.

Thanks

fullheart avatar Apr 25 '23 13:04 fullheart