|
|
|
|||||
|
Events, authentication, C#
Hello
First off, I've been looking for a project like Ice for a while. I think it's great .I have a mixed bag of comments, questions and suggestions: 1. Why not implement event semantics a la .NET? I realise that this approach has scalability issues, however there's nothing to stop you using the full-blown event service when you need scalability. And an event with only a few listeners is a common case. 2. Let's say I want to implement a service registry similar to IceBox, which will also provide authentication services. I authenticate myself to the server, and the server then directs me to a third party (that is, it gives me a proxy object). That third party wants to check if I'm legitimate; so somehow it has to know who I am. Once it knows who I am, it can check with the server to see if a certain level of access is available. Would it be possible to provide that "who-is" information in the form of a cookie supplied to the proxy by the server, rather than implementing an IIsAuthenticated interface on all the clients? This business of cookies generalizes to: "can I pass extra information to the third party via the proxy I give to to the client?" (Update: I see you specifically don't do this, so as to keep your proxies simple) 3. What are the plans for the C# mapping? I'd like to help out. Regards David Turner Last edited by DavidTurner : 05-26-2003 at 03:03 AM. |
|
|||||
|
Re: Re: Events, authentication, C#
Quote:
delegate void EventHandler(args);[*]Declare an "event" of that type: event EventHandler MyEvent;[*]Subscribe to the event: MyObject.MyEvent += new EventHandler(MyHandler);[*]Generate the event: MyEvent(args);[/list=1] I think the syntax could be improved: the idea of a delegate is actually an implementation detail, not an entity in its own right. But the basic idea is that interfaces/classes support events as first-class members, and the language (or in this case, Ice) takes care of maintaining the subscriber list. It also means that you don't have to have a separate callback interface for each type of event, and resolves all those hassles with colliding callback names - with this model, I can subscribe to two similar events using different functions, rather than passing context. Quote:
What I'm really after is some sort of automatic connection tracking, such that the server can tell "who's asking" by means of each client having a unique id attached to the proxies it gets (cookies! ). The client shouldn't be aware of it at all. I could possibly hack the same information out of the SSL certificates, but not reliably. Am I missing something obvious?Note that the "server" I'm talking about may be distributed over several machines... Some more about the events, as a postscript: I find that I use events far more than properties these days. In fact, my ideal object consists only of events and methods. Think about it. Properties are properly encapsulated as method calls, and asynchronous transactions are just about as common as synchronous transactions. The way I would do events is as follows: class MyServer { event MyEvent(args); void some_function() { MyEvent(args); } } // subscriber: MyServer& svr = ...; svr.MyEvent.subscribe(MyCallback); svr.MyEvent.unsubscribe(MyCallback); |
|
|||||
|
Just some additional comments about 'events'.
The 'delegate' and 'event' models in C# are syntactic sugar to implement asynchronous callbacks. The issue with C# is that the syntax is not fully consistant (in my opinion) and the type checking is weak. But, I agree with the potential of making objects work together by sending asynchronous messages (i.e. events) as it greatly simplifies programmation. A very nice library that uses it is Qt (with notions like SIGNALs and SLOTs), but it requires pre-processing (moc). An excellent C++ add-on that does the same thing is freely available with "sigslot" (http://sigslot.sourceforge.net/). Written entirely with the C++ template mechanism (generic programming), it helps connecting objects without any knowledge from each other (weak coupling). |
|
|||||
|
Re: More about events...
Quote:
).I agree with you about the syntactical consistency and type checking. It is actually possible to implement sigslot-type events with something like Ice (or CORBA) inbetween. It isn't pretty, though, and the syntax certainly doesn't make ones intentions clear. Events deserve to be first class interface members more than properties do. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Authentication support for SSAPI or Kerberos? | crackajaxx | Comments | 6 | 05-26-2005 03:06 PM |
| Timeouts for unusual events | rhochmuth | Help Center | 11 | 05-18-2005 12:09 AM |
| Multicast Events | jody | Comments | 5 | 03-11-2005 04:03 PM |