Fork me on GitHub
#ring-swagger
<
2017-02-06
>
leena11:02:10

Getting this exception: Caused by: java.lang.IllegalArgumentException: No method in multimethod 'restructure-param' for dispatch value: :auth-rules

juhoteperi11:02:22

@leena Yes, it should work

leena11:02:40

hmm, why is it casting the exception?

juhoteperi11:02:47

Have you required backend.restructure on the namespace where you try to use :auth-rules

juhoteperi11:02:14

The error might be caused by the multimethod implementation not being loaded

leena12:02:08

yes it would work now

leena12:02:40

We would actually not need the session part, is there a simpled example somewhere with just token and buddy with compojure-api?

juhoteperi12:02:15

@leena I don't think so, but the only change should be remove wrap-session and provide buddy middlewares with token backend instead of session: https://funcool.github.io/buddy-auth/latest/api/buddy.auth.backends.token.html

juhoteperi12:02:46

the restructure-params would stay the same, as buddy middlewares add same :identity property to the request map

juhoteperi12:02:00

Oh, and you wouldn't need login and logout routes

juhoteperi12:02:42

For authentication in Swagger-UI, it is possible to configure api token auth for Swagger

juhoteperi12:02:16

I have and you need some code to generate the tokens for clients. I have a example in one project, I'll update the gist.

leena12:02:45

the client already has the token, I just need to check that it is valid

juhoteperi12:02:56

that depends what data the token contains (or if the token just points to a entity in database)

juhoteperi14:02:11

I think the :authfn option of jws backend is where you should check if the token is valid

juhoteperi14:02:00

then the authenticated etc predicates work like normally, (:identity request) would always contain information about valid user data

ikitommi14:02:30

if the current user is not needed, a simple middleware would be enougj :middleware [wrap-require-token]?

leena15:02:09

@ikitommi Optimal solution would be for each endpoint 1. check if token is valid and 2. parse/unsign it 3. get user from token for that particular endpoint

mrchance17:02:08

Hi, is there a way to name your parameter fooBar for swagger, but get it as foo-bar?

mrchance17:02:22

e.g. in a json body?