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

Lack of information on how to use this library #6

Closed
Repulser opened this issue Jan 3, 2018 · 13 comments
Closed

Lack of information on how to use this library #6

Repulser opened this issue Jan 3, 2018 · 13 comments

Comments

@Repulser
Copy link

Repulser commented Jan 3, 2018

Im trying to use this library and am failing to understand how to use the token store, any insight would be much appreciated.

@caelcs
Copy link
Owner

caelcs commented Jan 3, 2018

Well no much to do... just need two things... annotate your Main Spring Boot application class and then make sure that you have the properties required.

You can have a look to this integration test to see how it works.

https://github.com/caelwinner/spring-security-mongo/blob/master/src/test/java/uk/co/caeldev/springsecuritymongo/MongoClientDetailsServiceIntegrationTest.java

@caelcs
Copy link
Owner

caelcs commented Jan 3, 2018

and one more thing, this library provides you all the beans that you may need to configure your different repositories like store, client credentials etc.
If you want to know how to configure the Spring OAuth2 using this library you can look at the project in my oath2-server and have a look to the spring oauth2 doc.

@Repulser
Copy link
Author

Repulser commented Jan 4, 2018

By looking at the Oauth 2 server code, it seems that MongoTokenStore should be a bean?
Though Ive added the @EnableMongoSecurity annotation and still get
Parameter 1 of constructor in catalogue.mobile.AuthorizationServerConfig required a bean of type 'uk.co.caeldev.springsecuritymongo.MongoTokenStore' that could not be found.

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018 via email

@Repulser
Copy link
Author

Repulser commented Jan 4, 2018

That was it!! thanks a lot, I added them and everything started working, one last question: is there a way to use my own mongo client and authenticate on my own?

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018 via email

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018

you can always override the mongo client provided by defining your own and using the @primary annotation 👍

@Repulser
Copy link
Author

Repulser commented Jan 4, 2018

I meant authenticating with mongo, the @Primary worked perfectly, thanks! though theres still the need to define the properties, is there a way to avoid this or should i just pseudo-define them?

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018 via email

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018 via email

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018 via email

@Repulser
Copy link
Author

Repulser commented Jan 4, 2018

Nothing really, im just using mongo for other things and would like to share the client, aswell as using different methods of authentication....
Removing the requirement for the properties would be nice, though ill just fill them with randomness for now.

@caelcs
Copy link
Owner

caelcs commented Jan 4, 2018

I have release version 2.0.0 adding only the Mongo Client when the properties has been set. Can I close this issue?

@caelcs caelcs closed this as completed Jan 5, 2018
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

No branches or pull requests

2 participants