Giter VIP home page Giter VIP logo

rhino-licensing's Introduction

Rhino-Licensing

A software licensing framework https://www.hibernatingrhinos.com/oss/rhino-licensing http://ayende.com

how to build

The solution can be directly compiled with visual studio note: the psake build is currently broken

To create the nuget package run buildNuget.bat

how to run the tests

Please note that in order to run the tests you must either run them in the context of the administrator or run the following command: netsh http add urlacl url=http://+:19292/license user=YOUR_USER_NAME

acknowledgements

Rhino Licensing is making use of the excellent log4net logging framework

rhino-licensing's People

Contributors

ayende avatar brunomlopes avatar dazinator avatar heskandari avatar jmelhus avatar livioc avatar missaak avatar pathoschild avatar stemarie avatar tpwalke2 avatar trailway avatar vlow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rhino-licensing's Issues

Documentation? .NET Core support?

Is there any documentation or quick start guide about the recommended ways to use the library?

Any plans to support .NET Core 1.1?

User cannot clone a license or use a template

Say I have a license and want to issue it to a different user, other than creating a new one and manually entering all the key/value parameters by hand -which can be many!- there is no way to achieve this with the current UI. For example if you have an application with certain parameters, you would want to issue licenses to different end users.

An alternative (or perhaps extra feature) would be to allow the user of the tool to define License Templates that can be cloned for reissuing to various end-users.

Rhino.Licensing.AdminTool fails to open an existing project

Hi,

there is an error causing the Rhino.Licensing.AdminTool application to fail when trying to fail an existing project.

In the file rhino-licensing/Rhino.Licensing.AdminTool/Views/ShellView.xaml instead of the line

<MenuItem Header="_Open Project" InputGestureText="Ctrl+O" cal:Message.Attach="[Gesture MouseAction: LeftClick]" />

the line

<MenuItem Header="_Open Project" InputGestureText="Ctrl+O" cal:Message.Attach="[Gesture MouseAction: LeftClick]=[Action OpenProject];[Gesture Key:O, Modifiers:Control]=[Action OpenProject]" />

shoul be used.

Greetings,

jslavik

Different version for log4net dependency

It seems that the assembly dependency and the NuGet dependency for log4net have a conflict.

In the live NuGet 1.3 version of this package, it relies on log4net 2.x; however, the assembly itself has a hard dependency on log4net 1.2.11.0.

My workaround is to simply have log4net 1.2.11.0 in my own NuGet packages.config, and then there are no loading problems.

Problem with admin tool

1.git clone project
2.create assembiles with psake:

PS S:\rhino-licensing> Invoke-psake .\default.ps1
psake version 4.2.0
Copyright (c) 2010 James Kovacs

Executing Clean
Executing Init
Generating assembly info file: S:\rhino-licensing\Rhino.Licensing\Properties\AssemblyInfo.cs
Generating assembly info file: S:\rhino-licensing\Rhino.Licensing.Tests\Properties\AssemblyInfo.cs
Generating assembly info file: S:\rhino-licensing\Rhino.Licensing.AdminTool\Properties\AssemblyInfo.cs
Generating assembly info file: S:\rhino-licensing\Rhino.Licensing.AdminTool.Tests\Properties\AssemblyInfo.cs


    Directory: S:\rhino-licensing


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d----        2014-06-30     10:29            Release
d----        2014-06-30     10:29            build
Executing Compile
2014-06-30 10:29:52: An Error Occurred:
Exec : Cannot process argument transformation on parameter 'cmd'. Cannot convert the "msbuild" value of type "System.St
ring" to type "System.Management.Automation.ScriptBlock".
At S:\rhino-licensing\default.ps1:69 char:7
+   exec <<<<  msbuild "/p:OutDir=""$buildartifacts_dir "" $sln_file"
    + CategoryInfo          : InvalidData: (:) [Exec], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Exec

(I think that it went ok and psake complains about missing msbuild.exe, I do not have msvcvarsXX env set by default)

3.Open visual studio express 2013
4.Build all
5.Run admin tool
6.File -> Open generates following exception:

A first chance exception of type 'Caliburn.Core.CaliburnException' occurred in     Caliburn.PresentationFramework.dll
An unhandled exception of type 'Caliburn.Core.CaliburnException' occurred in Caliburn.PresentationFramework.dll
Additional information: There was no handler found for the message Action: Gesture MouseAction.

Git master, rev 55960af

ValidateUsingNetworkTime

I've encountered a problem while testing the network time validation. My test:

  • The license-file that I was testing was already expired
  • I've set my clock to a day before the license expire date
  • Loading the license and calling 'AssertValidLicense'

When I noticed that I didn't get any exception, I started digging..
I noticed that the exception gets lost in the sntp.BeginGetDate-thread. I don't know if i'm doing something wrong, but to continue my testing I've added a quick fix (I'm struggling with inserting code, but you'll get the point):

`
private void ValidateUsingNetworkTime()
{
if (!NetworkInterface.GetIsNetworkAvailable())
return;

        bool isLicenseValid = true;
        ManualResetEvent timeRequestDone = new ManualResetEvent(false);

        var sntp = new SntpClient(GetTimeServers());
        sntp.BeginGetDate(time =>
        {
            if (time > ExpirationDate)
                isLicenseValid = true;

            timeRequestDone.Set();
        }
        , () =>
        {
            /* ignored */
        });

        timeRequestDone.WaitOne();
        if (!isLicenseValid)
            RaiseLicenseInvalidated();

    }`

Subscription experation -4 days

Could you please exlain why you have the following line of code within ValidateSubscription? I have been testing an app using it and wanted to see what happens the day before and the day of expiration, but kept getting failures for both. Upon stepping through the code I found the following line, but there was no comment on the reason why expired is expired date plus four days?

if ((ExpirationDate - DateTime.UtcNow).TotalDays > 4)

SntpClient failure notification

The SntpClient class is notifying failures multiple times. This can be reproduced by pulling the network cable from machine. I added the following check to avoid this:

    public void BeginGetDate(Action<DateTime> getTime, Action failure)
    {
        _index += 1;
        if (_hosts.Length <= _index)
        {
            if (_hosts.Length == _index)
            {
                failure();
            }
            return;
        }

I suspect that there may be a deeper problem here but the fix isn't obvious to me.

nist1.sjc.certifiedtime.com is no longer.

Rhino.Licensing. AbstractLicenseValidator Contains a hardcoded list of time servers.

https://github.com/ayende/rhino-licensing/blob/master/Rhino.Licensing/AbstractLicenseValidator.cs#L39

One of which is nist1.sjc.certifiedtime.com which is no longer up and causes a cascade of exceptions to be thrown.

System.Net.Sockets.SocketException occurred
  Message=No such host is known
       at System.Net.Dns.HostResolutionEndHelper(IAsyncResult asyncResult)

Then:

System.ObjectDisposedException occurred
  Message=Cannot access a disposed object.
Object name: 'System.Net.Sockets.UdpClient'.
       at System.Net.Sockets.UdpClient.EndReceive(IAsyncResult asyncResult, IPEndPoint& remoteEP)

and:

System.NullReferenceException occurred
  Message=Object reference not set to an instance of an object.
  StackTrace:
       at Rhino.Licensing.SntpClient.MaybeOperationTimeout(Object state, Boolean timedOut) in :line 
  InnerException:
{System.NullReferenceException: Object reference not set to an instance of an object.
   at Rhino.Licensing.SntpClient.MaybeOperationTimeout(Object state, Boolean timedOut) in :line 0}

missing build howto?

looks good, could just someone please hint me on how to build this.
ant, nant, msbuild, any off the ps files?

obviuosly i can hack the missing assemblyinfo.cs files, but I would prefer the authors intended way to bulid this.

thank you
thomas

Test uses wrong port

Will submit PR. one of the tests uses the wrong port number - it uses 29292 instead of 19292.

Add NuGet

How about a NuGet package?
Any plans for it?

Trail mode is easy bypassed

Looking through the code it shows that Trial licensing relies on the local computers date/time to validate expiration which is easily circumvented with programs like RunAsDate. Validation of date/time should always occur using a time server, although I question if even that is proper because one could write ones own UDP server and redirect Nist traffic to it.

Perhaps there is a better way to validate date/time for trials. Thoughts?

bool result;
if (LicenseType == LicenseType.Subscription)
    result = ValidateSubscription();
else
    result = DateTime.UtcNow < ExpirationDate; // bad

if (result) // this should be if (LicenseType != LicenseType.Subscription)
    ValidateUsingNetworkTime();
else
    throw new LicenseExpiredException("Expiration Date : " + ExpirationDate);

AbstractLicenceValidator - Socket Exception in the discoveryHost start method.

In our project, we are testing the AbstractLicenceValidator.

We got an Exception with DiscoveryHost. It was a SocketException.
I have lost the stackTrace of the exception, but, i'm opening an issue to give you the solution that we applied in our project.

To resolve the problem, we have add a new constructor of AbstractLicenceValidator.
This constructor contain a boolean parameter that can enable or disable the discoveryhost.

There is the constructor :

    protected AbstractLicenseValidator(string publicKey, bool enableDiscovery = true)
    {
        LeaseTimeout = TimeSpan.FromMinutes(5);
        LicenseAttributes = new Dictionary<string, string>();
        nextLeaseTimer = new Timer(LeaseLicenseAgain);
        this.publicKey = publicKey;
        SetupDiscoveryHost(enableDiscovery);
    }

The Constructor call this Method :

    private void SetupDiscoveryHost(bool enableDiscovery)
    {
        DiscoveryEnabled = enableDiscovery;

        if (!enableDiscovery) return;

        senderId = Guid.NewGuid();
        discoveryHost = new DiscoveryHost();
        discoveryHost.ClientDiscovered += DiscoveryHostOnClientDiscovered;
        discoveryHost.Start();
    }

So.... In Conclusion, do you think that this solution can be add to your product ?

If yes, can you advise me when this new constructor will be available in the futur nuget package of Rhino.Licensing ?

Thanks to your team!

Not possible to edit a loaded license

Once you OK a license or load it from its .RLIC file the license entry will be shown in the UI but one is not able to edit it for example if one wishes to re-issue a license.

The need exists also because there is no way to clone a license to issue it with different parameters. For example if I wanted to create a PREMIUM license set of key/value items based on a DEMO that has the same but with different values.

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.