Fork me on GitHub
#ring-swagger
<
2017-08-30
>
eoliphant03:08:24

Hi I have a question on security. I’m trying to use :securityDefinitions, I’ve configured one and now I want to apply it to my routes. in looking at the swagger spec i’m supposed to set up a security block or somethign that refers to the securityDefinition(s). Does anyone have any examples of this? Basically, I’ve gotten JWT working one route, but now I want to apply it globally

abarylko06:08:22

@eoliphant I have this in my api

acron12:08:32

Can’t import ring.util.response/get-charset, try updating to Ring 1.6.0+
Exception in thread "main" java.lang.ExceptionInInitializerError
	at clojure.main.<clinit>(main.java:20)
Caused by: java.lang.NullPointerException, compiling:(ring/util/http_response.clj:1142:1)
	at clojure.lang.Compiler.load(Compiler.java:7442)
	at clojure.lang.RT.loadResourceScript(RT.java:374)
	at clojure.lang.RT.loadResourceScript(RT.java:365)

acron12:08:41

I'm getting this error, but...

acron12:08:50

$ lein deps :tree | grep ring
       [com.amazonaws/aws-java-sdk-marketplacemeteringservice "1.11.98"]
   [metosin/ring-http-response "0.9.0"]
   [metosin/ring-swagger-ui "2.2.10"]
   [metosin/ring-swagger "0.24.1"]
 [metrics-clojure-ring "2.9.0" :exclusions [[org.slf4j/slf4j-api]]]
 [ring-cors "0.1.8"]
 [ring/ring-core "1.6.2"]
   [ring/ring-codec "1.0.1"]

acron12:08:57

Ring 1.6.2

acron12:08:16

Trying to use metosin/compojure-api "2.0.0-alpha7"

eoliphant13:08:07

Hmm, @abarylko how do you guys actually use it ? I added the :security [:bearer], the generated swagger endpoints have a little exclamation point and when you click it you can see a button for “Authorization” but it doesn’t do anything. I’d kind of thought that that config would do somethng like add an authorization header param to each endpoint

abarylko15:08:26

The authorization button opens a dialog to enter your jwt token

ikitommi20:08:21

@acron are you using lein ring? That overrides the project deps, could cause that.

ikitommi20:08:20

or just add the latest ring as direct dependency, should override any transitive deps.

abarylko21:08:27

Is anybody using the new Swagger UI ?