ace-auth 服务小记

作者: 骑着红驴逛青楼 | 来源:发表于2018-07-23 11:45 被阅读0次

    ace-security介绍(微服务开源框架):

    ace-security项目是国内大神基于spring全家桶开发的关于微服务的开源框架!其中使用到的技术包括主流的spring boot,spring security,spring cloud等等;

    项目网址:https://gitee.com/minull/ace-security

    ace-auth服务(鉴权服务):

    大体流程图:

    大体思路:

    步骤1:用户登录获取令牌usertoken(通过spring security 实现)

    步骤2:通过验证后返回usertoken

    步骤3:携带usertoken访问服务(资源);

    注意:该框架中所有的请求都会走网关服务(ace-gate),然后网关通过feign调用其他服务;在feign调用其他服务之前会走fegin拦截器,拦截器会把服务自身的clientToken和userToken放到request中,这样当访问资源之前,spring 拦截器(userAuthRestInterceptor,serviceAuthInterceptor)就会对clientToken和userToken检查,通过则允许访问

    步骤4:userAuthRestInterceptor,serviceAuthInterceptor检验clientToken和userToken

    步骤5:检验通过

    步骤6:返回目标资源

    如果调用的 目标服务中,还会调用其他服务,就会再次走3,4,5,6步骤;

    总结:服务鉴权是通过Feign拦截器和spring拦截器实现的,服务调用服务之前会通过Feign拦截器传入userTokean,clientTokean,这样到访问资源时userAuthRestInterceptor,serviceAuthInterceptor就可以进行验证了;

    关联知识:

    Spring security OAuth2资料:

    1.http://www.ruanyifeng.com/blog/2014/05/oauth_2_0.html

    2.https://www.jianshu.com/p/6dd03375224d

    3.http://www.spring4all.com/article/449



    相关文章

      网友评论

        本文标题:ace-auth 服务小记

        本文链接:https://www.haomeiwen.com/subject/aqidmftx.html