Custom Assets Configuration#
The Janssen Server provides multiple configuration tools to configure custom assets.
Use the command line to perform actions from the terminal. Learn how to use Jans CLI here or jump straight to the Using Command Line
Use a fully functional text-based user interface from the terminal. Learn how to use Jans Text-based UI (TUI) here or jump straight to the Using Text-based UI
Use REST API for programmatic access or invoke via tools like CURL or Postman. Learn how to use Janssen Server Config API here or Jump straight to the Using Configuration REST API
Using The Command Line#
In the Janssen Server, you can deploy custom assets using the
command line. To get the details of Janssen command line operations relevant to
the custom assets, check the operations under the JansAssets
task using the
command below.
/opt/jans/jans-cli/config-cli.py --info JansAssets
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
Get All Current Custom Assets#
Use the operation ID get-all-assets
to get all the currently configured
custom assets on the Janssen Server.
/opt/jans/jans-cli/config-cli.py --operation-id get-all-assets
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
|
Get Custom Asset By inum#
With get-asset-by-inum
operation-id, we can get any specific asset matched
with inum
. If we know the inum
, we can simply use the below command:
/opt/jans/jans-cli/config-cli.py --operation-id get-asset-by-inum \
--url-suffix inum:61edc29d-45f8-4ab9-8c9a-7b39e4cbe440
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Get Custom Asset By Name#
With get-asset-by-name
operation-id, we can get any specific asset matched with name
.
If we know the name
, we can simply use the below command:
/opt/jans/jans-cli/config-cli.py --operation-id get-asset-by-name \
--url-suffix name:p1.properties
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Get Services#
Get the list of Janssen Server services that support custom assets
by performing get-asset-services
operation.
/opt/jans/jans-cli/config-cli.py --operation-id get-asset-services
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 |
|
Get Valid Asset Types#
Get the asset types of your Janssen Server by performing get-asset-types
operation.
/opt/jans/jans-cli/config-cli.py --operation-id get-asset-types
Sample Output | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 |
|
Add New Custom Asset#
To create a new asset, we can use post-new-asset
operation id. As shown in
the output for --info
command, the post-new-asset
operation requires data to be sent according to AssetForm
schema.
To see the schema, use the command below:
/opt/jans/jans-cli/config-cli.py --schema AssetForm
For better understanding, the Janssen Server also provides a sample of data to be sent to the server. This sample conforms to the schema above. Use the command below to get the sample.
/opt/jans/jans-cli/config-cli.py --schema-sample AssetForm
Using the schema and the example above, we have added below data to the
file /tmp/add-asset.json
. Example below will load p3.properties
file as
a custom asset to the jans-auth
service.
Input | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|
/opt/jans/jans-cli/config-cli.py --operation-id post-new-asset \
--data /tmp/add-asset.json
Update Existing Custom Assets#
Use the put-asset
operation to update an existing asset. This operation uses
same schema as add new asset operation. For example,
assuming that there is an existing asset as show below:
Existing Asset | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Note
assetFile
attribute is optional for update operation as there may be scenario where only metadata of an asset is to be updated.
Now to update level of this asset to 6, create a text file with following
content in it. Let's name this text file as /tmp/update-asset.json
Input | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
Now use the command below to update the asset with new value for level.
/opt/jans/jans-cli/config-cli.py --operation-id put-asset \
--data /tmp/update-asset.json
Upon successful execution, this command will return with updated asset values.
Return values | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Delete Custom Asset#
You can delete any custom asset by its inum
value.
/opt/jans/jans-cli/config-cli.py --operation-id delete-asset \
--url-suffix inum:61edc29d-45f8-4ab9-8c9a-7b39e4cbe440
Using Text-based UI#
In Janssen, You can deploy custom asset using the Text-Based UI also.
You can start TUI using the command below:
sudo /opt/jans/jans-cli/jans_cli_tui.py
Asset Screen#
Navigate to Assets
tab to open the Assets screen as shown in the image below.
- To get the list of currently added Assets, bring the control to the Search
box (using the tab key), and press Enter. Type the search string to search
for Asset with matching
inum
, orFile Name
orDescription
- Use the
Add Asset
button to create a new asset. - From the screen below, select the custom asset that needs to be uploaded and select the Janssen Server service to which the asset will be uploaded.
Using Configuration REST API#
Janssen Server Configuration REST API exposes relevant endpoints for managing and configuring the custom assets. Endpoint details are published in the Swagger document.
Created: 2021-04-16