Giter Site home page Giter Site logo

spring-cloud-oauth2-jdbc's Introduction

2017-10-14

参考资料

    项目                  端口	描述
    api-gateway             8080	网关 zuul-proxy
    discovery-server        8761	eureka-server
    auth-server             9091	
    user-service            9092	resource-server

简介

    优点 : 
        1. 使用 数据库 保存用户数据,客户数据,和 token。代码比较规范,说的比较明白。
        2. 使用 zuul 和 服务名称访问服务,而不是使用硬编码的URL,这样可以实现负载均衡
    缺点 :以下 curl 命令访问受保护资源失败,报告说 invalid_token , 

    curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "grant_type=password&username=admin&password=admin&redirect_uri=http://localhost:9092/users" "http://web:web_secret@localhost:9091/uaa/oauth/token"
    TOKEN=c94c84b5-7816-4a51-a2c3-e1cb2dbb8fef
    curl -H "Authorization: Bearer $TOKEN" http://localhost:9092/users
    
   
    9092 应用程序异常 :
    
    2017-10-14 21:45:54.801 DEBUG 11852 --- [nio-9091-exec-8] o.s.s.w.a.i.FilterSecurityInterceptor    : Secure object: FilterInvocation: URL: /user; Attributes: [authenticated]
    2017-10-14 21:45:54.801 DEBUG 11852 --- [nio-9091-exec-8] o.s.b.a.audit.listener.AuditListener     : AuditEvent [timestamp=Sat Oct 14 21:45:54 CST 2017, principal=<unknown>, type=AUTHENTICATION_FAILURE, data={type=org.springframework.security.authentication.AuthenticationCredentialsNotFoundException, message=An Authentication object was not found in the SecurityContext}]
    2017-10-14 21:45:54.802 DEBUG 11852 --- [nio-9091-exec-8] o.s.s.w.a.ExceptionTranslationFilter     : Authentication exception occurred; redirecting to authentication entry point
    
    org.springframework.security.authentication.AuthenticationCredentialsNotFoundException: An Authentication object was not found in the SecurityContext

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.