In the class level use something like:

@SwaggerDefinition(securityDefinition = @SecurityDefinition(
    apiKeyAuthDefinitions = {
        @ApiKeyAuthDefinition(key = "jwt.auth", name =
"Authorization", in = ApiKeyLocation.HEADER, description = "JWT")}))

and change the key in the method level to match.
It's important to note that SwaggerUI doesn't keep a session, you have to
provide the authentication for the endpoints that requiere it. There's a
lock logo in the methods that requiere authentication, it opens the form to
provide your previously acquired token.

On Fri, Nov 1, 2019 at 1:37 PM Jason Novotny <[email protected]>
wrote:

> Ah ok, I'm doing Bearer tokens- what are the annotations I need for that?
>
> Thanks, Jason
>
> On Fri, Nov 1, 2019, 1:34 PM Leonardo Contreras Alfonso <
> [email protected]> wrote:
>
>> I use it, in an authentication service that handles 4 identity providers,
>> Basic and Bearer.
>> You need the three annotations, and make sure your swagger is the last
>> version.
>>
>> On Fri, Nov 1, 2019 at 1:16 PM Jason Novotny <[email protected]>
>> wrote:
>>
>>> Hi Leonardo,
>>>
>>> Thanks for the tip. However the  API call requiring authentication
>>> doesn't work after I invoke the login API-- I get error 401 that
>>> credentials are required to access this resource" because there appears to
>>> be no way to supply the token received from the login API call. Does anyone
>>> actually use Swagger or is it just for illustration purposes?
>>>
>>> If anyone has any swagger page showing how to get a credential and use
>>> it in subsequent calls, I'd be highly appreciative.
>>>
>>> Thanks, Jason
>>> On 11/1/19 1:03 PM, Leonardo Contreras Alfonso wrote:
>>>
>>> @ApiParam(hidden = true)
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "dropwizard-user" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/dropwizard-user/71f8b7bb-c686-4d39-5134-1dc8d2f716e9%40gmail.com
>>> <https://groups.google.com/d/msgid/dropwizard-user/71f8b7bb-c686-4d39-5134-1dc8d2f716e9%40gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>
>>
>> --
>> -----------------------------------------------------------
>> Leonardo Contreras Alfonso
>> Bogotá D.C. - Colombia
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "dropwizard-user" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/dropwizard-user/hH6R2544yaQ/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/dropwizard-user/CABPXi_r45JRk55Bjje2GXHQwajFfh%2B4k3AjsedXNFokZxQQFtA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/dropwizard-user/CABPXi_r45JRk55Bjje2GXHQwajFfh%2B4k3AjsedXNFokZxQQFtA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "dropwizard-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dropwizard-user/CAJrD__-eS2j--Fqxyvnv5F2GBYmbdrsM2L09npoNm0cs7FZfWg%40mail.gmail.com
> <https://groups.google.com/d/msgid/dropwizard-user/CAJrD__-eS2j--Fqxyvnv5F2GBYmbdrsM2L09npoNm0cs7FZfWg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>


-- 
-----------------------------------------------------------
Leonardo Contreras Alfonso
Bogotá D.C. - Colombia

-- 
You received this message because you are subscribed to the Google Groups 
"dropwizard-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dropwizard-user/CABPXi_phKw8__%3D1dmWuuqnh%3DeOAfReJiAOi%3Dw-CqHvAb%3DoC%3Dsw%40mail.gmail.com.

Reply via email to