outmoded / tv

Interactive debug console

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

public folder is authenticated

opened this issue · comments

Hello, first of all ty for this great hapijs plugin!
Since im using the plugin currently in an app which has an auth strategy i noticed something i can't explain to my self.

The plugins main route, delivering the view itself is explicitly stated to be ignored for authentication. which seems correct for a default value, because actually the login process could be the first thing i want to inspect via TV.

server.route({
            method: 'GET',
            path: settings.endpoint,
            config: {
                auth: false,                        // In case defaults are set otherwise
                handler: ...

But then again, the configuration for the public directory handler, which serves the css and js file is setted to be authenticated. Which unfourtunately leads to errors while loading /debug/console .

 server.route({
        method: 'GET',
        path: settings.endpoint + '/{file*2}',
        config: {
            handler: {
                directory: {
                    path: Path.join(__dirname, '../public'),
                    ...      

I don't see any way of configuration to be passed in to the plugin to circumvent this behaviour. So i am wondering if this is intentional and i am missing something obvious here?

Ty in advance for your response!

This looks like a bug, the plugin should make those routes ignore authentication as well. Are you interested in submitting a PR to fix this?

Yes. I will push a fix which makes the validation configurable by tomorrow.

Fixed via #104

@geek Looks like 4.1.0 milestone is complete - will this be shipping to NPM soon? Currently I'm running off of a fork which has this fix.

Thanks!

@briandela sorry for the delay. v4.1.0 is now published