Labs64 / NetLicensing-Demo

Labs64 NetLicensing / Demo Application
https://netlicensing.io
MIT License
6 stars 3 forks source link

Support validation via NetLicensing Agent #7

Closed r-brown closed 7 years ago

r-brown commented 7 years ago

NetLicensing Demo cannot be used with NetLicensing Agent at the moment. No error messages are shown to the user as well.


How to reproduce:

import assets locally

$ java -jar netlicensing-agent-2.3.7-ALPHA1.jar --action=import-assets

start NetLicensing Agent

$ java -jar netlicensing-agent-2.3.7-ALPHA1.jar --action=run-agent-offline --agent.port=8888

- modify `.env` properties to point to local running NetLicensing Agent

NetLicensing configuration

NLIC_AGENT_BASE_URL=http://localhost:8888/rest


- [validate](https://www.labs64.de/confluence/display/NLICPUB/Licensee+Services#LicenseeServices-Validatelicensee) test [Licensee](https://www.labs64.de/confluence/x/sQCo) once again

### Expected result:
- validation operation returns valid NetLicensing response
- CRUD operations to create not existing entities need to be omitted
v-rudkovskiy commented 7 years ago

Done in Labs64/NetLicensing-Demo@150935b A little remade the setup/validate form, I think you should like it.

netlicensing-demo-agent-validate

r-brown commented 7 years ago

Validation on not existing licensee returns

Validation - Error
Undefined offset: 1

UPD: as well as existing

r-brown commented 7 years ago

How to reproduce:

Manual validation

Validate via netlicensing.io

$ curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/xml' --header 'Authorization: Basic ZGVtbzpkZW1v' 'https://go.netlicensing.io/core/v2/rest/licensee/L-69761077/validate'

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:netlicensing xmlns="http://www.w3.org/2000/09/xmldsig#" xmlns:ns2="http://netlicensing.labs64.com/schema/context" ttl="2017-07-14T04:18:17.439Z">
  <ns2:infos/>
  <ns2:items>
    <ns2:item type="ProductModuleValidation">
      <ns2:property name="productModuleNumber">PM-64160267</ns2:property>
      <ns2:property name="valid">true</ns2:property>
      <ns2:property name="expires">2017-07-24T04:16:39.152Z</ns2:property>
      <ns2:property name="productModuleName">Module licensed under Subscription licensing model</ns2:property>
      <ns2:property name="licensingModel">Subscription</ns2:property>
    </ns2:item>
  </ns2:items>
</ns2:netlicensing>

Export / import NetLicensing assets (demo:demo)

Start NetLicensing Agent

Validate via NetLicensing Agent

$ curl -X POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/xml' --header 'Authorization: Basic ZGVtbzpkZW1v' 'http://localhost:8888/rest/licensee/L-69761077/validate'

<?xml version="1.0" encoding="UTF-8"?>
<ns3:netlicensing xmlns:ns2="http://www.w3.org/2000/09/xmldsig#" xmlns:ns3="http://netlicensing.labs64.com/schema/context" ttl="2017-07-14T04:23:27.753Z">
  <ns3:infos/>
  <ns3:items>
    <ns3:item type="ProductModuleValidation">
      <ns3:property name="productModuleNumber">PM-64160267</ns3:property>
      <ns3:property name="valid">true</ns3:property>
      <ns3:property name="expires">2017-07-24T04:16:39.152Z</ns3:property>
      <ns3:property name="productModuleName">Module licensed under Subscription licensing model</ns3:property>
      <ns3:property name="licensingModel">Subscription</ns3:property>
    </ns3:item>
  </ns3:items>
</ns3:netlicensing>

it works

Validation via NetLicensing Demo and NetLicensing Agent

labs64 netlicensing demo agent error

doesn't work


Local configuration at .env

# NetLicensing Connection
# NetLicensing Core URL; default: https://go.netlicensing.io/core/v2/rest
NLIC_BASE_URL=https://go.netlicensing.io/core/v2/rest
# (optional) NetLicensing Agent URL; e.g. http://localhost:8888/rest
NLIC_AGENT_BASE_URL=http://localhost:8888/rest

# NetLicensing Auth
NLIC_AUTH_USERNAME=demo
NLIC_AUTH_PASSWORD=demo
NLIC_AUTH_API_KEY=73ed204b-155f-4513-a349-77d34774ccaf
r-brown commented 7 years ago

I WANT TO CONNECT FROM A CONTAINER TO A SERVICE ON THE HOST

The Mac has a changing IP address (or none if you have no network access). From 17.06 onwards our recommendation is to connect to the special Mac-only DNS name docker.for.mac.localhost which will resolve to the internal IP address used by the host.

https://docs.docker.com/docker-for-mac/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host


On MAC OS following NetLicensing Agent configuration need to be used:

NLIC_AGENT_BASE_URL=http://docker.for.mac.localhost:8888/rest

2017-07-17_13-43-50