Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration from Swagger Spring MVC to Swagger Springfox 2.0.3 #1635

Merged
merged 5 commits into from Jun 29, 2015
Merged

Migration from Swagger Spring MVC to Swagger Springfox 2.0.3 #1635

merged 5 commits into from Jun 29, 2015

Conversation

gmarziou
Copy link
Contributor

  • no more swagger-ui directory under webapp
  • no more swagger dependency in bower.json
  • version of the API in application.yml

It fully works with maven + grunt.

With gradle + gulp, it works with gradle (port 8080) however it does not work
with gulp (port 3000) I tried to configure the proxy for /swagger-ui.html nut it does not seem to work.
I'm not even sure it was working previously, I'll try.

Re #1508

- no more swagger-ui directory under webapp
- no more swagger dependency in bower.json
- version of the API in application.yml

It fully works with maven + grunt.

With gradle + gulp, it works with gradle (port 8080) however it does not work
from gulp (port 3000) I tried to configure the proxy for /swagger-ui.html nut it does not seem to work.
I'm not even sure it was working previously, I'll try.

Re #1508
@gmarziou
Copy link
Contributor Author

Thanks I'll try when I'll fix Travis CI failed check.

@gmarziou gmarziou changed the title Migration from Swagger Spring MVC to Swagger Springfox 2.0.2 Migration from Swagger Spring MVC to Swagger Springfox 2.0.3 Jun 24, 2015
@gmarziou
Copy link
Contributor Author

gulp is now working.

I encountered issue #1639 which is not related to SpringFox.

… into swagger_2_1508

Conflicts:
	app/templates/_gradle.properties

Re #1508
@jdubois
Copy link
Member

jdubois commented Jun 26, 2015

Looks good to me!!

@jdubois
Copy link
Member

jdubois commented Jun 26, 2015

@gmarziou it fails with the token-based authentication, so I can't merge it at the moment.
I was expecting this -> btw OAuth2 works, and shouldn't be much different.

@gmarziou
Copy link
Contributor Author

I have never used token-based authentication but let me know if I can help.

@jdubois
Copy link
Member

jdubois commented Jun 26, 2015

@gmarziou can you try to generate with the token-based option?
I'll have a look on Sunday, probably.
I remember there was a trick with Swagger 1, and anyway it shouldn't be much different than OAuth2, so it's doable.

@gmarziou
Copy link
Contributor Author

I generated with the token-based option, I authenticated as admin, when I go to API doc page I get these 401 errors:

GET http://127.0.1.1:8080/configuration/security 401 (Unauthorized)
GET http://127.0.1.1:8080/configuration/ui 401 (Unauthorized)
GET http://127.0.1.1:8080/v2/api-docs 401 (Unauthorized)

It's because the iframe does not have the token.

@jdubois
Copy link
Member

jdubois commented Jun 28, 2015

@gmarziou this should be doable, as I'm doing it this in other parts of the apps (for the Gatling scripts, for example).
Anyway, I didn't code the first Swagger integration, and I've tested it and realized it wasn't working either!!!
So that's bad, but your PR didn't break anything that wasn't already broken :-)
-> this is why I am going to merge this

Of course, this should be documented, etc, and as it's a bit late today, I'll merge this tomorrow.
Thanks for the great work!

jdubois added a commit that referenced this pull request Jun 29, 2015
Migration from Swagger Spring MVC to Swagger Springfox 2.0.3
@jdubois jdubois merged commit 111ceb7 into jhipster:master Jun 29, 2015
@jdubois jdubois mentioned this pull request Jul 3, 2015
@cbornet
Copy link
Member

cbornet commented Jul 4, 2015

@jdubois @gmarziou I think swagger ui currently only supports 3-legged Oauth and not the password flow which is used by jhipster.
Even if it were working, the springfox Docket would have to be configured (with securitySchemes and securityContexts)

@fontanellif
Copy link

@jdubois, If i have an old version of jhipster i have to manually remove the swagger-ui directory under webapp. Right?

Another question: Using Oauth authentication i see that in the class OAuth2ServerConfiguration probably are missing the following configurations ( but i'm not sure):

.antMatchers("/v2/api-docs/**").hasAuthority(AuthoritiesConstants.ADMIN) .antMatchers("/configuration/security").hasAuthority(AuthoritiesConstants.ADMIN) .antMatchers("/configuration/ui").hasAuthority(AuthoritiesConstants.ADMIN) .antMatchers("/swagger-ui.html").hasAuthority(AuthoritiesConstants.ADMIN)

@gmarziou
Copy link
Contributor Author

gmarziou commented Jul 6, 2015

Yes this is correct. To test this, you can have a look at the requests in your browser console.

@gmarziou gmarziou deleted the swagger_2_1508 branch August 14, 2015 21:33
@jdubois jdubois modified the milestone: Untracked PRs Oct 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants