Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Show otpauth URI during TOTP setup #5784

Open
suspectpart opened this issue Nov 22, 2023 · 2 comments
Open

Feature Request: Show otpauth URI during TOTP setup #5784

suspectpart opened this issue Nov 22, 2023 · 2 comments
Labels

Comments

@suspectpart
Copy link

When setting up two factor authentication, a QR code is shown to be scanned with TOTP device:

before

This is sufficient for all users that setup their token generator devices with a camera-enabled device, e.g. a mobile application in Android or iOS or with a hardware token that has a built-in camera.

For all other users that need to flash a hardware token without a camera or that use software like KeePassXC, the otpauth:// is required in plain text. Of course one could scan the QR code to extract the URL, but that is kind of clumsy.

As an example, LinOTP (a software that we use internally for managing general MFA tokens) allows for displaying the token information as both a otpauth:// as well as a seed:// URI:

linotp

Adding something like that to SeaHub as well to support advanced enrollment scenarios seems like not a big change.

I did a little proof of concept by adding a line in

def get_context_data(self, form, **kwargs):

to:

def get_context_data(self, form, **kwargs):
        context = super(SetupView, self).get_context_data(form, **kwargs)
        if self.steps.current == 'generator':
            key = self.get_key('generator')
            rawkey = unhexlify(key.encode('ascii'))
            b32key = b32encode(rawkey).decode('utf-8')
            self.request.session[QR_SESSION_KEY] = b32key

            # ====> Generate otpauth:// URL and add it to context
            otpauth_url = get_otpauth_url(
                accountname=self.request.user.username,
                issuer=config.SITE_NAME,
                secret=b32key,
                digits=totp_digits()
            )
            context.update({'QR_URL': reverse(self.qrcode_url), 'OATH_URL': otpauth_url})

and then including that URL in the two factor setup template

<img src="{{ QR_URL }}" alt="QR Code" />
.

As a result, the otpauth:// URL is displayed alongside the QR code:

after

Do you think something like that would be feasible? It would really improve enrollment workflows when a camera-enabled device is not an option.

@suspectpart
Copy link
Author

bump

Any comment on this feature request?

@freeplant
Copy link
Member

We have recorded the requirement internally. It is currently a low priority task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants