diff --git a/src/main/java/com/jaguarlandrover/rvi/DlinkAuthPacket.java b/src/main/java/com/jaguarlandrover/rvi/DlinkAuthPacket.java index efd0536..a0196d8 100644 --- a/src/main/java/com/jaguarlandrover/rvi/DlinkAuthPacket.java +++ b/src/main/java/com/jaguarlandrover/rvi/DlinkAuthPacket.java @@ -41,12 +41,12 @@ class DlinkAuthPacket extends DlinkPacket /** * Default constructor */ - DlinkAuthPacket() { + DlinkAuthPacket(ArrayList creds) { super(Command.AUTHORIZE); mAddr = "0.0.0.0"; mPort = 0; mVer = "1.0"; - mCreds = new ArrayList(Arrays.asList("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyaWdodF90b19pbnZva2UiOlsiZ2VuaXZpLm9yZyJdLCJpc3MiOiJqbHIuY29tIiwiZGV2aWNlX2NlcnQiOiJNSUlCOHpDQ0FWd0NBUUV3RFFZSktvWklodmNOQVFFTEJRQXdRakVMTUFrR0ExVUVCaE1DVlZNeER6QU5CZ05WQkFnTUJrOXlaV2R2YmpFUk1BOEdBMVVFQnd3SVVHOXlkR3hoYm1ReER6QU5CZ05WQkFvTUJrZEZUa2xXU1RBZUZ3MHhOVEV4TWpjeU16RTBOVEphRncweE5qRXhNall5TXpFME5USmFNRUl4Q3pBSkJnTlZCQVlUQWxWVE1ROHdEUVlEVlFRSURBWlBjbVZuYjI0eEVUQVBCZ05WQkFjTUNGQnZjblJzWVc1a01ROHdEUVlEVlFRS0RBWkhSVTVKVmtrd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFKdHZpTThBUklyRnF1UGMwbXlCOUJ1RjlNZGtBLzJTYXRxYlpNV2VUT1VKSEdyakJERUVNTFE3ems4QXlCbWk3UnF1WVlaczY3U3lMaHlsVkdLaDZzSkFsZWN4YkhVd2o3Y1pTUzFibUtNamU2TDYxZ0t3eEJtMk5JRlUxY1ZsMmpKbFRhVTlWWWhNNHhrNTd5ajI4bmtOeFNZV1AxdmJGWDJORFgyaUg3YjVBZ01CQUFFd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ1lFQWhicVZyOUUvME03MjluYzZESStxZ3FzUlNNZm95dkEzQ21uL0VDeGwxeWJHa3V6TzdzQjhmR2pnTVE5enpjYjZxMXVQM3dHalBpb3FNeW1pWVlqVW1DVHZ6ZHZSQlorNlNEanJaZndVdVlleGlLcUk5QVA2WEthSGxBTDE0K3JLKzZITjR1SWtaY0l6UHdTTUhpaDFic1RScHlZNVozQ1VEY0RKa1l0VmJZcz0iLCJ2YWxpZGl0eSI6eyJzdGFydCI6MTQ1MjE5Mjc3Nywic3RvcCI6MTQ4MzcyODc3N30sInJpZ2h0X3RvX3JlZ2lzdGVyIjpbImdlbml2aS5vcmciXSwiY3JlYXRlX3RpbWVzdGFtcCI6MTQ1MjE5Mjc3NywiaWQiOiJpbnNlY3VyZV9jcmVkZW50aWFscyJ9.TBDUJFL1IQ039Lz7SIkcblhz62jO35STJ8OiclL_xlxEE_L_EjnELrDOGvkIh7zhhl8RMHkUJcTFQKF7P6WDJ5rUJejXJlkTRf-aVmHqEhpspRw6xD2u_2A9wmTWLJF94_wsEb7M7xWCXVrbexu_oik85zmuxRQgRE5wrTC7DDQ")); + mCreds = creds; } } diff --git a/src/main/java/com/jaguarlandrover/rvi/RVINode.java b/src/main/java/com/jaguarlandrover/rvi/RVINode.java index 6369ff8..0bda8b2 100644 --- a/src/main/java/com/jaguarlandrover/rvi/RVINode.java +++ b/src/main/java/com/jaguarlandrover/rvi/RVINode.java @@ -34,6 +34,7 @@ public class RVINode { private final static String TAG = "RVI:RVINode"; + private ArrayList mCredentials = new ArrayList<>(); private HashMap mAllServiceBundles = new HashMap<>(); private RemoteConnectionManager mRemoteConnectionManager = new RemoteConnectionManager(); @@ -49,7 +50,7 @@ public void onRVIDidConnect() { mIsConnected = true; if (mListener != null) mListener.nodeDidConnect(); - mRemoteConnectionManager.sendPacket(new DlinkAuthPacket()); + mRemoteConnectionManager.sendPacket(new DlinkAuthPacket(mCredentials)); } @Override @@ -153,6 +154,15 @@ public void setServerPort(Integer serverPort) { } + /** + * Method to pass the SDK your app's JWT-encoded json credentials for invoking services on a remote node and receiving service invocations from a remote node. + * + * @param jwtString a jwt-encoded credentials string + */ + public void addJWTCredentials(String jwtString) { + mCredentials.add(jwtString); + } + /** * Sets the server port of the remote RVI node, when using a TCP/IP link to interface with a remote node. *