Embed the Database Autonomy Service (DAS) console into your O&M platform so your users can access database monitoring without a separate logon. The integration uses Security Token Service (STS) temporary credentials and Alibaba Cloud's federation endpoint to generate a logon-free URL that loads the DAS console inside an iframe.
The process has three steps:
-
Call AssumeRole to get temporary credentials for a RAM role.
-
Exchange the credentials for a logon token at the federation endpoint.
-
Construct a logon-free URL and load it in an iframe.
Prerequisites
Before you begin, ensure that you have:
-
A RAM user with the STS policy attached. For setup instructions, see Grant permissions to a RAM user
Step 1: Get temporary credentials
Call the AssumeRole API operation to assume a RAM role and receive temporary credentials (access key ID, access key secret, and security token).
For background on RAM roles, see RAM role overview.
Step 2: Exchange credentials for a logon token
Use the security token to obtain a logon token.
The DAS domain used in subsequent steps depends on the TicketType value you specify:
TicketType value |
DAS domain |
|---|---|
normal (default) |
https://hdm.console.alibabacloud.com |
mini (partner BID) |
https://hdm4servims.console.alibabacloud.com |
Step 3: Construct the logon-free URL
URL format
Build the logon-free URL using the following format:
https://signin.aliyun.com/federation?Action=Login
&LoginUrl=<URL on your platform that returns HTTP 302>
&Destination=<DAS page to load>
&SigninToken=<logon token from step 2>
The DAS domain in the Destination parameter must match the TicketType you used in step 2:
-
TicketType=normal→https://hdm.console.alibabacloud.com -
TicketType=mini→https://hdm4servims.console.alibabacloud.com
Configure the Destination URL
Set Destination to the DAS page you want to embed. To embed the DAS dashboard, use:
https://hdm.console.alibabacloud.com/?hideTopbar=true&isShare=true&hideMenu=true#/dashboard/convoy
isShare=true and hideTopbar=true are required parameters and must appear before # in the URL.
Use the following query parameters to customize the DAS console UI:
| Parameter | Description |
|---|---|
isShare=true |
Enables embedding the DAS console in an external console |
hideTopbar=true |
Hides the top navigation bar |
hideMenu=true |
Hides the external menu |
hideInstanceMenu=true |
Hides the sidebars on the instance details page and the external bars of the DAS console |
hideAutonomousButton=true |
Hides the autonomy service switch |
Code example
The following Java example shows how to build the logon-free URL. Comments reference the step numbers in this guide.
private static String getHdmLoginUrl(String pageUrl, String signInToken) throws URISyntaxException {
// Step 3: Build the federation URL with all required parameters
URIBuilder builder = new URIBuilder(SIGN_IN_DOMAIN);
builder.setParameter("Action", "Login");
// LoginUrl: the URL on your platform that returns HTTP 302 to redirect the user
builder.setParameter("LoginUrl", "https://signin.aliyun.com/login.htm");
// Destination: the DAS page to load (e.g., global dashboard, instance details)
builder.setParameter("Destination", pageUrl);
// SigninToken: the logon token obtained in step 2
builder.setParameter("SigninToken", signInToken);
HttpGet request = new HttpGet(builder.build());
return request.getURI().toString();
}
What's next
-
To adjust RAM role permissions, see RAM role overview.