|
Infralution Support Support groups for Infralution products
|
View previous topic :: View next topic |
Author |
Message |
BradBeech
Joined: 08 Jan 2015 Posts: 10
|
Posted: Tue Nov 10, 2015 9:50 am Post subject: StartBackgroundReauthentication and reauthenticationInterval |
|
|
Hi
I am unit testing the scenario whereby a user:
a) Installs a license successfully.
b) I kill the authentication service to simulate network being down.
c) Do a wait to increase time since LastAuthenticationDate
d) Restarts app and load the license successfully.
e) Call StartBackgroundReauthentication(TimeSpan.FromMilliseconds(1), TimeSpan.Zero)
I expected a BackgroundReauthenticationFailed to be fired, as the time since last authentication date has been exceeded, and the authentication server could not be reached.
I think in the given scenario so long as the server cannot be reached (network cable unplugged for e.g.) the user will we be able to continue using the license.
It seems in the AuthenticatedLicenseProvider.AtomicBackgroundReauthenticate, the this.Reauthenticate() throws a System.Net.Sockets.SocketException, which returns to the general catch in BackgroundReauthenticationThread, and continues looping.
I'm using 6.0.2
Thanks |
|
Back to top |
|
|
BradBeech
Joined: 08 Jan 2015 Posts: 10
|
Posted: Tue Nov 10, 2015 12:56 pm Post subject: |
|
|
Come to think of it I am probably confusing two features.
One is how often in a given period of time to try reach the authentication server (reduce load on server for e.g.) the idea is if you have already connected once today, don't bother again until, maybe tomorrow. This seem like the reason for StartBackgroundReauthentication(x,x).
I'm trying to use it for a very similar but slightly different reason - I want the user to be able to be disconnected from the internet for a set period, of say 2 weeks, and still be able to work. However the license can still be valid, but if the authentication server as not contacted within the last 2 weeks the then program should not start up (business requirement, and assists with when an authentication is deleted, to invalidate the program).
I think I need a combination of the two:
a) I still want to attempt to authenticate only once a day (I'll use the StartBackgroundReauthentication).
b) But I'll enforce a shutdown myself if the LastAuthenticationDate is greater than the 2 weeks ago.
a) above should still happen daily so that a full 2 weeks is possible from the last authentication date . If we only re-authenticate every 2 weeks then it is possible that the machine could still have contact the server for a couple of days since the last authentication, but we didn't try, and hence the 2 week grace period is effectively shortened for the user.
Does any of this make sense? |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Nov 10, 2015 10:04 pm Post subject: |
|
|
Background reauthentication does not fail (raise the BackgroundReauthenticationFailed event) if the server cannot be connected to. This is by design - since you don't want your customers applications to stop working because your server was temporarily down - or because their internet connection was down temporarily.
The primary purpose of the reauthentication interval (in the StartBackgroundReauthentication method) is, as you say, to reduce load on the server. If you want to enforce a maximum time allowed between the license being reauthenticated then you could implement this yourself by checking the license.AuthenticationDate when you start the application and if this is too long ago, display an error message to the user, and provide an option for them to reauthenticate the license right then (your code would call AuthenticatedLicenseProvider.Reauthenticate). _________________ Infralution Support |
|
Back to top |
|
|
BradBeech
Joined: 08 Jan 2015 Posts: 10
|
Posted: Wed Nov 11, 2015 5:17 am Post subject: |
|
|
Thank you, I am going to do that. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|