Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Description

This sample is a Java back-end application running on the Cloud Foundry. For all incoming requests it checks whether the user is authorized using the IasTokenAuthenticator which is defined in the Java Security library.
Disclaimer: as of now the IAS token can only be validated in case the token from the consuming application is issued for the same IAS tenant.

Deployment on Cloud Foundry

To deploy the application, the following steps are required:

  • Compile the Java application
  • Create a ias service instance
  • Configure the manifest
  • Deploy the application
  • Access the application

Compile the Java application

Run maven to package the application

mvn clean package

Create the ias service instance

Use the ias service broker and create a service instance (don't forget to replace the placeholders)

cf create-service identity application ias-java-security

Configure the manifest

The vars contains hosts and paths that need to be adopted.

Deploy the application

Deploy the application using cf push. It will expect 1 GB of free memory quota.

cf push --vars-file ../vars.yml

Access the application

  1. Follow HowToFetchToken guide to fetch IAS id token.

    You can get the information to fill the placeholders from your system environment cf env java-security-usage-ias

    Copy the id_token to your clipboard.

  2. Access the app via curl. Don't forget to fill the placeholders.

    curl -X GET \
      https://java-security-usage-ias-<<ID>>.<<LANDSCAPE_APPS_DOMAIN>>/hello-java-security-ias \
      -H 'Authorization: Bearer <<your id_token>>'
    
  3. You should see something like this:

    You ('<your email>') are authenticated and can access the application.
    

    💡 If you call the same endpoint without Authorization header you should get a 401.

Clean-Up

Finally delete your application and your service instances using the following commands:

cf us java-security-usage-ias ias-java-security
cf delete -f java-security-usage-ias
cf delete-service -f ias-java-security