Coder Social home page Coder Social logo

Dubbo Token验证 about dubbo HOT 6 CLOSED

yutian avatar yutian commented on May 24, 2024
Dubbo Token验证

from dubbo.

Comments (6)

dreambt avatar dreambt commented on May 24, 2024 3

仔细看图:提供方将令牌告之注册中心,由注册中心决定是否告之消费方

from dubbo.

chenjie901 avatar chenjie901 commented on May 24, 2024

我测试发现只有dubbo协议才支持token认证

from dubbo.

xue8710 avatar xue8710 commented on May 24, 2024

@chenjie901 确实不支持

from dubbo.

qrqhuang avatar qrqhuang commented on May 24, 2024

这个就尴尬了

from dubbo.

cvictory avatar cvictory commented on May 24, 2024

I have run a demo for testing this case.

I used zookeeper as service discovery.

  1. add token : <dubbo:service interface="org.apache.dubbo.demo.DemoService" ref="demoService" version="1.0.4" token="45678"/>
  2. remove token from Attachment at org.apache.dubbo.rpc.protocol.dubbo.DubboInvoker#DubboInvoker .

And then it not work, and throw :

org.apache.dubbo.rpc.RpcException: Invalid token! Forbid invoke remote service interface org.apache.dubbo.demo.DemoService method sayHello() from consumer 30.5.125.8 to provider 30.5.125.8
	at org.apache.dubbo.rpc.filter.TokenFilter.invoke(TokenFilter.java:46)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at org.apache.dubbo.rpc.protocol.dubbo.filter.TraceFilter.invoke(TraceFilter.java:78)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at org.apache.dubbo.rpc.filter.ContextFilter.invoke(ContextFilter.java:73)
	at org.apache.dubbo.rpc.protocol.ProtocolFilterWrapper$1.invoke(ProtocolFilterWrapper.java:72)
	at org.apache.dubbo.rpc.filter.GenericFilter.invoke(GenericFilter.java:138)

So I think it work well. The situation that how to use token :

  • The consumer invoke provider directly but not from service discovery provider list. It can forbid it.
  • You service discovery should have more feature that control to send token to some consumer but not to send token to other consumer. But it depend on special service discovery.

from dubbo.

cvictory avatar cvictory commented on May 24, 2024

&READY-TO-CLOSE&

from dubbo.

Related Issues (20)

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.