Before the integration, we need to deploy Casdoor locally.
Then we can quickly implement a Casdoor-based login page in our own app with the following steps.
Step1. Configure Casdoor application
- Create or use an existing Casdoor application.
- Add a redirect url:
- Copy the client ID, we will need it in the following steps.
Step2. Add user in Casdoor
Now you have the application, but not a user. That means you need to create a user and assign the role.
Go to the “Users” page and click on “Add user” in the top right corner. That opens a new page where you can add the new user.
Save the user after adding a username and adding the organisation CloudFoundry(other details are optional).
Now you need to set up a password for your user, which you can do by clicking manage your password.
Choose a password for your user and confirm it.
Step3. Build CloudFoundry App
Start the CloudFoundry by follow.
- $git clone git://github.com/cloudfoundry/uaa.git
- $ cd uaa
- $./gradlew run
Step4. Integrate Casdoor
Now open another command line and input :
- $ curl 'http://localhost/oauth/authorize?response_type=token&client_id=app&scope=openid&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fapp%2F' -i -X GET \ -H 'Accept: application/x-www-form-urlencoded'
we have already got the client_id and redirect_uri before, we input these parameters.
execute the command, we can get the result below, which means that we have integrated Casdoor with CloudFoundry successfully.