This is a sample java servlet to demonstrate how to create and use appusers through the Box Java SDK.
We have not included any security features in the application and strictly recommend NOT to use any part of the application for production usage. Do not store any sensitive data in the application.
We recommend creating a test developer enterprise and a test application within the enterprise, and integrating the sample Box Applicaiton's API key with this sample Application. Once the testing is done, we recommend stopping the server , deleting the app from the Box developer console and ending all Box sessions tied to the sample application, and deleting the appusers created in the test enterprise from the admin console.
The public and private key pairs used along with this sample application should not be reused with applications handling production data and should be discarded once testing completes
Usage of this sample application with production enterprises or production data is highly undesirable.
Box is not responsible for any security incidents that may arise due to the unsafe usage of this sample application.
This sample application requires that download and install the Box Java SDK https://github.com/box/box-java-sdk
In order to run this example you will need to have Maven installed. On a Mac, you can install Maven with brew:
brew install mavenCheck that your maven version is 3.0.x or above:
mvn -v#####Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files If you don't install this, you'll get an exception about key length. This is not a Box thing, this is a U.S. Government requirement concerning strong encryption. Please follow the instructions exactly.
You will need to create an application that supports app users and describe in in a configuration file like the following:
boxClientId=<YOUR_BOX_CLIENT_ID>
boxClientSecret=<YOUR_BOX_CLIENT_SECRET>
boxEnterpriseId=<YOUR_BOX_ENTERPRISE_ID>
boxPrivateKeyFile=<YOUR_JWT_PRIVATE_KEY_FILENAME>
boxPrivateKeyPassword=<YOUR_JWT_PRIVATE_KEY_PASSWORD>
boxPublicKeyId=<YOUR_JWT_PUBLIC_KEY_ID>These steps are described heere https://docs.box.com/docs/configuring-box-platform You must complete Steps 1 through 4 to enable this sample application
In order to build and run the project you must execute:
mvn clean jetty:rungradle jettyRunWarThen, go to http://localhost:8080/login.