Skip to content

Commit

Permalink
[55792] Added an api method to RVI node to take jwt credentials dynam…
Browse files Browse the repository at this point in the history
…ically.

(cherry picked from commit 1b0375fcff8c20300539d5ac993159f4cf4311a2)
  • Loading branch information
lillialexis committed Mar 21, 2016
1 parent 69cc4aa commit bb62841
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/jaguarlandrover/rvi/DlinkAuthPacket.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class DlinkAuthPacket extends DlinkPacket
/**
* Default constructor
*/
DlinkAuthPacket() {
DlinkAuthPacket(ArrayList<String> creds) {
super(Command.AUTHORIZE);

mAddr = "0.0.0.0";
mPort = 0;
mVer = "1.0";
mCreds = new ArrayList<String>(Arrays.asList("eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJyaWdodF90b19pbnZva2UiOlsiZ2VuaXZpLm9yZyJdLCJpc3MiOiJqbHIuY29tIiwiZGV2aWNlX2NlcnQiOiJNSUlCOHpDQ0FWd0NBUUV3RFFZSktvWklodmNOQVFFTEJRQXdRakVMTUFrR0ExVUVCaE1DVlZNeER6QU5CZ05WQkFnTUJrOXlaV2R2YmpFUk1BOEdBMVVFQnd3SVVHOXlkR3hoYm1ReER6QU5CZ05WQkFvTUJrZEZUa2xXU1RBZUZ3MHhOVEV4TWpjeU16RTBOVEphRncweE5qRXhNall5TXpFME5USmFNRUl4Q3pBSkJnTlZCQVlUQWxWVE1ROHdEUVlEVlFRSURBWlBjbVZuYjI0eEVUQVBCZ05WQkFjTUNGQnZjblJzWVc1a01ROHdEUVlEVlFRS0RBWkhSVTVKVmtrd2daOHdEUVlKS29aSWh2Y05BUUVCQlFBRGdZMEFNSUdKQW9HQkFKdHZpTThBUklyRnF1UGMwbXlCOUJ1RjlNZGtBLzJTYXRxYlpNV2VUT1VKSEdyakJERUVNTFE3ems4QXlCbWk3UnF1WVlaczY3U3lMaHlsVkdLaDZzSkFsZWN4YkhVd2o3Y1pTUzFibUtNamU2TDYxZ0t3eEJtMk5JRlUxY1ZsMmpKbFRhVTlWWWhNNHhrNTd5ajI4bmtOeFNZV1AxdmJGWDJORFgyaUg3YjVBZ01CQUFFd0RRWUpLb1pJaHZjTkFRRUxCUUFEZ1lFQWhicVZyOUUvME03MjluYzZESStxZ3FzUlNNZm95dkEzQ21uL0VDeGwxeWJHa3V6TzdzQjhmR2pnTVE5enpjYjZxMXVQM3dHalBpb3FNeW1pWVlqVW1DVHZ6ZHZSQlorNlNEanJaZndVdVlleGlLcUk5QVA2WEthSGxBTDE0K3JLKzZITjR1SWtaY0l6UHdTTUhpaDFic1RScHlZNVozQ1VEY0RKa1l0VmJZcz0iLCJ2YWxpZGl0eSI6eyJzdGFydCI6MTQ1MjE5Mjc3Nywic3RvcCI6MTQ4MzcyODc3N30sInJpZ2h0X3RvX3JlZ2lzdGVyIjpbImdlbml2aS5vcmciXSwiY3JlYXRlX3RpbWVzdGFtcCI6MTQ1MjE5Mjc3NywiaWQiOiJpbnNlY3VyZV9jcmVkZW50aWFscyJ9.TBDUJFL1IQ039Lz7SIkcblhz62jO35STJ8OiclL_xlxEE_L_EjnELrDOGvkIh7zhhl8RMHkUJcTFQKF7P6WDJ5rUJejXJlkTRf-aVmHqEhpspRw6xD2u_2A9wmTWLJF94_wsEb7M7xWCXVrbexu_oik85zmuxRQgRE5wrTC7DDQ"));
mCreds = creds;
}
}
12 changes: 11 additions & 1 deletion src/main/java/com/jaguarlandrover/rvi/RVINode.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class RVINode
{
private final static String TAG = "RVI:RVINode";

private ArrayList<String> mCredentials = new ArrayList<>();
private HashMap<String, ServiceBundle> mAllServiceBundles = new HashMap<>();
private RemoteConnectionManager mRemoteConnectionManager = new RemoteConnectionManager();

Expand All @@ -49,7 +50,7 @@ public void onRVIDidConnect() {
mIsConnected = true;
if (mListener != null) mListener.nodeDidConnect();

mRemoteConnectionManager.sendPacket(new DlinkAuthPacket());
mRemoteConnectionManager.sendPacket(new DlinkAuthPacket(mCredentials));
}

@Override
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit bb62841

Please sign in to comment.