ProgramingGirl
ProgramingGirl

Reputation: 23

Spring-Security for Android

I'm writing application for android.
I have used SpringBoot, SpringData JPA and Retrofit to connect Android with TomCat. I'm trying to do authentication in my Android Aplication with Spring Security.
My requirement is that, once the users are authenticated they will be sent token to use for subsequent calls.
Could you please provide me and example what I have to do this.

Upvotes: 0

Views: 2482

Answers (1)

vsoni
vsoni

Reputation: 2858

What I understand from your question is

  1. How will you build a spring based server application that employs token based security?

Ans. - For this you need to create server application with Oauth2 security using JWT tokens. You can refer these tutorials for the same. http://www.baeldung.com/spring-security-oauth-jwt Apart from this you can find many other sample tutorials on google and samples on github. Use this link for basic reference. http://projects.spring.io/spring-security-oauth/docs/oauth2.html

  1. How you will handle token based security at Android based UI application.

Ans. You can refer following tutorial for the same. http://www.baeldung.com/retrofit

Hope this helps.

UPDATE - 19-11-2019

If you do not need/want oauth2 server for authentication, you can use pure filter based spring security also. Ref - https://medium.com/@hantsy/protect-rest-apis-with-spring-security-and-jwt-5fbc90305cc5

It shows how you can use jwt token based security using spring boot.

Upvotes: 1

Related Questions