You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "cvictory (GitHub)" <gi...@apache.org> on 2018/11/07 08:01:16 UTC

[GitHub] [incubator-dubbo] cvictory commented on issue #33: Dubbo Token验证

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.







[ Full content available at: https://github.com/apache/incubator-dubbo/issues/33 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org