Skip to content
Using Spring Cloud Zuul and Spring Security as the Dependency, the authentication system implemented by JWT, which supports role based authentication .
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
conf
db
pic
zuul-auth-api-company
zuul-auth-api-personal
zuul-auth-config-server
zuul-auth-eureka
zuul-auth-gateway
zuul-auth-token-manager
.gitignore
LICENSE
README.md
pom.xml

README.md

spring-cloud-zuul-authentication

Using Spring Cloud Zuul and Spring Security as the Dependency, the authentication system implemented by JWT, which supports role based authentication .

the er pic is simple :

er.jpg

how to use

  • start eureka , api-company , api-personal , gateway , token-manager

  • open eureka , you can find our server is registed , like this :

eureka.jpg

  • while the server under runing , we can start using , and first of all , we need get our token for users.

    We assume that personal user is logged in with a mobile phone number, and an company user is using an email to log in.

    • login for personal users .

      personal_login.jpg

    • login for company users .

      • login as boss

      boss_login.jpg

      • login as manager

      manager_login.jpg

      • login as employee

      employee_login.jpg

  • now , let's see how to use the token for different roles .

    First of all , we need to set "Authorization" in Headers , which value should be like Bearer + " " + ${token} , for example :

    authorization.jpg

    next , we can use the token to do something meaningful .

    • A personal user wants to say hello :

      personal_greeting.jpg

    • A personal user wants to view boss's api :

      unauthorized.jpg

    • A employee user wants to say hello :

      employee_greeting.jpg

    • A employee user wants to view manager's api :

      unauthorized.jpg

    • A manager user wants to say hello :

      manager_greeting.jpg

    • A manager user wants to view employee's api :

      employee_greeting.jpg

    • A manager user wants to view boss's api :

      unauthorized.jpg

    • A boss user wants to say hello :

      boss_greeting.jpg

You can’t perform that action at this time.