4
I Use This!
Inactive

News

Analyzed 3 days ago. based on code collected 4 days ago.
Posted over 10 years ago by yallie
[en] Added AuthRequestMessage.ClientAddress property to be able to authenticate users by their IP addresses.
Posted over 10 years ago by yallie
Hi!   Erstmal: Super Arbeit, die du/ihr hier leistet.   Thanks!   Server soll die IP erfahren/erkennen können, wovon sich der Client anmeldet   If you need to get client's IP address during normal method execution (i.e. when the user is already ... [More] logged on), use ServerSession.CurrentSession.ClientAddress. But if you need to get the IP address of an unauthenticated user during the IAuthenticationProvider.Authenticate method call, use AuthRequestMessage.ClientAddress property: public class IPBasedAuthenticationProvider : IAuthenticationProvider { public AuthResponseMessage Authenticate(AuthRequestMessage authRequest) { Console.WriteLine("Authenticating... IP address: {0}", authRequest.ClientAddress); return new AuthResponseMessage() { Success = true, AuthenticatedIdentity = WindowsIdentity.GetAnonymous() }; } } Please note that this feature is not in production yet. You need to build Zyan from the latest sources to get ClientAddress property.   Ich möchte die bei der Anmeldung gültigen Rechte eines Benutzers zwischen speichern um sie in den Modulen (die alle per MEF geladen werden) dann auch abzufragen.   You can use session variables to cache user's permissions as well as other session-specific data. Load them once from the database, store in the current session and query whenever you need to check permissions. Here is an example: // note that current session is not yet available during the Authenticate method call var currentSession = Session.CurrentSession; // load current user's permissions from the database by user name var userPermissions = LoadFromDatabase(currentSession.Identity.Name); // cache permissions in the current session currentSession.SessionVariables["Permissions"] = userPermissions; // access loaded permissions somewhere else var permissions = currentSession.SessionVariables["Permissions"] as UserPermissions; if (!permissions.Check(somePermission)) { throw new InvalidOperationException("Access denied."); } DoSomethingThatRequiresPermissions(...); Let me know if this helps. [Less]
Posted over 10 years ago by yallie
Hi, ServerSession class has a property of client's IP address. You can use it on the server-side as follows: var address = ServerSession.CurrentSession.ClientAddress; But, when authentication provider is executed, server session is not yet ... [More] initialized. If you need to get client IP address during the Authenticate method call, use AuthRequestMessage.ClientAddress property: public class MyAuthenticationProvider : IAuthenticationProvider { public AuthResponseMessage Authenticate(AuthRequestMessage authRequest) { IIdentity identity = WindowsIdentity.GetAnonymous(); Console.WriteLine("Authenticating... IP address: {0}", authRequest.ClientAddress); return new AuthResponseMessage() { ErrorMessage = string.Empty, Success = true, AuthenticatedIdentity = identity }; } } Please note that this feature is not in production yet. You need to build Zyan from the latest sources to get ClientAddress property. Let me know if it helps. [Less]
Posted over 10 years ago by MyKey0815
Hallo, Erstmal: Super Arbeit, die du/ihr hier leistet. Zyan ist wirklich sehr zu empfehlen ich/wir sind total begeistert, wie einfach man damit eine Kommunikationsbasis für Client-Server Anwendungen erstellen kann. Ich frag mich immer wieder: wie ... [More] war das nur vor Zyan möglich ;-) Jetzt aber zu meinem Problem: Einfache Authentifizierungsszenarien hab ich fertiggestellt und die funktionieren auch. Nun bräuchte ich aber folgende Funktionalitäten: 1.) Server soll die IP erfahren/erkennen können, wovon sich der Client anmeldet 2.) Ich möchte die bei der Anmeldung gültigen Rechte eines Benutzers zwischen speichern um sie in den Modulen (die alle per MEF geladen werden) dann auch abzufragen. Das Auslesen des Benutzersnamens und dem danach dann gegen die Datenbank auszuführenden Prüfen, welche Rechte der Anwender hat, finde ich sehr unperformant Hier wird immer wieder auf die Sessions hingewiesen. Da ich aber für die Module ein If catalog.Parts.Count > 0 Then For Each obj As Object In catalog.Parts NLOGLOGGER.Debug("=>MEF: " & obj.ToString) Next ' 'MEF-Module' registrieren HostInstance.RegisterComponents(catalog) Else NLOGLOGGER.Debug("=>MEF: No additional Modules found!") End If benutze, kann ich da keine weiteren Parameter für irgent SessionManager hinzufügen. Könnte mir da jemand ein paar Tipps geben, wo ich welchen Code unterbringen muss, damit der Server durch die Sessioninformation weiß, welche Methoden er ausführen darf und welche nicht? Vielen Dank [Less]
Posted over 10 years ago by jasondun
I have Implement of IAuthenticationProvider , how can I get to the remote client ip address ?
Posted over 10 years ago by yallie
A few days ago I've got this message from Swifter:   I use your framework in my DronePhone GPS Tracker system to transfer GPS position information from my UDP server (which accepts the position data from a Windows Phone mounted on a flying ... [More] quadcopter) to a Bing map client, where the real-time position of the drone is displayed. So far, it works very well. I wrote my own UDP stuff, but your software made the TCP server to the WPF map clients very easy. You can see more info here: http://phantompilots.com/viewtopic.php?f=4&t=2700&p=18719 You can see a video of a flight synchronized with the DronePhone Map client here: http://www.youtube.com/watch?v=DS3cgnEKpKY It is best watched at full screen, 1080p. Enjoy, and thanks for the great software!   Awesome stuff! I wish it were open-source :) [Less]
Posted over 10 years ago by yallie
No, at least not in the current version. Zyan relies on .NET framework class library which is not available in javascript. For javascript, I'd recommend to have a looks at SignalR, a very promising realtime communication library for web. There ... [More] are no specific plans to port Zyan to other platforms than .NET. Although I have to admit that cross-compilers similar to JSIL or SharpKit can make it possible one day. [Less]
Posted over 10 years ago by jasondun
can I use javascript connect to zyan like WEBAPI?
Posted over 10 years ago by yallie
I just reproduced the issue. Looks like the source of the problem is your component registration: host.RegisterComponent<INotification>("Notification", () => { return container.GetExportedValue<INotification>(); ... [More] //return new Notification(); }); I didn't investigate the problem in details yet, but I think that it goes like this. You use RegisterComponent overload with a factory method to return a component instance. When you use factory method, Zyan assumes that every time you'll return a fresh instance of the component. For every new instance, we need to attach all event handlers before we use it to execute a remote call: // Zyan dispatcher (pseudocode) var instance = factory(); // create an instance of the component instance.Event += eventHandler; // attach event handler instance.ExecuteMethod(); // invoke remore method But you don't create a new instance. You just return whatever your container gives you with a GetExportedValue call. Looks like it gives you the same instance it returned the last time. Zyan reattaches event handlers again and again, so every time you'll get your handlers fired one extra time: twice, thrice, etc. Here is a quick experiment: please try uncommenting your first version of the above code. This version should run without repeated events: host.RegisterComponent<INotification>("Notification", () => { return new Notification(); // not using container anymore! }); The proposed solution If you use MEF integration, please don't resolve your components manually. Just use this overload to register all exported components at once: // first, prepare your MEF catalog, i.e. new AssemblyCatalog(Assembly.GetExecutingAssembly()); host.RegisterComponents(catalog); // register all Zyan components within the catalog Let me know if it makes sense. [Less]
Posted over 10 years ago by yallie
Hi youdontcay! When you fire an event once, your event handler is invoked several times — right? Sorry, I was unable to reproduce this behavior in my test project. Could you please zip and upload the complete sample project so I can debug it in ... [More] Visual Studio?   I found this example code. ... if (InvokeRequired) ...   This code is WinForms-specific. When event handler needs to access the UI, we must ensure that it's executed within main UI thread. That's why we call Control.Invoke method to create a marshaled callback. For WPF, similar code will look like this: TextBox.Dispatcher.Invoke( DispatcherPriority.Normal, () => TextBox.Text = "Event received!"); But this code has nothing to do with the repeated events. Please help me with the sample project so I can nail down the issue. Regards, yallie. [Less]