filebrowser / docs

📄 Who doesn't like documentation?
58 stars 38 forks source link

Complete docs about Authentication Provider #10

Closed josejuanmontiel closed 5 years ago

josejuanmontiel commented 5 years ago

Hi, i'm implementing a custom autenticator that call an external service, let's say an oath2 provider.

Following de docs... https://docs.filebrowser.xyz/contributing/authentication-provider i think it missed 2 extra stepts.

3º And this provider in the switch file.Settings.AuthMethod of cmd/config_import.go 4º And (maybe) to in switch inside func (s authBackend) Get(t settings.AuthMethod) (auth.Auther, error) of storage/bolt/auth.go

If consider it's correct, i may PR this change.

Later, maybe generalize my provider :)

Great work with this project.

eine commented 5 years ago

Hi @josejuanmontiel! Thanks for bringing this issue.

3º And this provider in the switch file.Settings.AuthMethod of cmd/config_import.go

I don't think this is required. The import feature is for users using v1 of filebrowser that now want to update to v2. Since the custom authenticator that you are developing did not exist in v1, it is unlikely that anyone will need to import it.

4º And (maybe) to in switch inside func (s authBackend) Get(t settings.AuthMethod) (auth.Auther, error) of storage/bolt/auth.go

Yes, I think this is correct, as it is used to update DB when the user changes the config.

If consider it's correct, i may PR this change.

Please, do it, and request a review by @hacdias.

eine commented 5 years ago

@josejuanmontiel, would you mind having a look at #11?

josejuanmontiel commented 5 years ago

Hi, sorry for the delay...

The #11 it's the same that i'm saying in my 4º, and you are right my 3º step it isn't necesary.

I would like to ask something more here. I implement this example new auth here https://github.com/josejuanmontiel/filebrowser/commit/9f9fa7d777098e060181bc5a775835d5d165c219 and later

./filebrowser config init ./filebrowser config set --auth.method=another ./filebrowser

It's enter, but this error appear

imagen

this is the log

2019/03/26 00:13:22 No config file used 2019/03/26 00:13:22 Listening on 127.0.0.1:8081 2019/03/26 00:13:27 /: 500 127.0.0.1:39178 the resource does not exist

What i'm missing in my user creation?

u := &users.User{}
u.Username = cred.Username
u.Password = cred.Password

err = u.Clean(root)
if err != nil {
    return nil, err
}

Thanks in advance.

josejuanmontiel commented 5 years ago

I discover my mistake (a long time, now i writing for futher user)... the user need to be create using filebrowser tool, althouth the password check can be overload with a custom autentication provider, because it's a autentication provider not authorization provider or another similar thing.

The error it's because the user doesn't exist in filebrowser database.