Configuring Access Permissions of OBS
OBS
OBS provides massive, secure, reliable, and cost-effective data storage capabilities for users to store data of any type and size.
Multimedia files such as images and voice files in the Enterprise Intelligence (EI) services can be directly processed by HUAWEI CLOUD OBS. This reduces service usage costs, shortens service response time, and improves service experience.
For data security purposes, NLP cannot directly obtain the user data. To obtain the user data, you need to enable the public read authentication.
Enabling Public Read Authorization
If public read authorization is enabled, data is visible and accessible to all users across the entire network. This method is not recommended for private data. The data privacy and expiration time cannot be guaranteed using this method.
To do so, configure the bucket policy to Public Read. For details about how to configure the public read policy, see Configuring a Standard Bucket Policy.
Only OBS links belonging to your own account can be used. Public-read OBS links of other users are not supported.
Using a Temporarily Authorized URL
Sensitive information, such as private data, may be disclosed. In this case, you are advised to use a temporarily authorized URL to access private files.
The temporary URL has a validity period. Use the temporary URL in its validity period.
For details about how to upload a file and obtain a temporary URL, see the following code:
String endPoint = "http://your-endpoint";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
//Create an ObsClient.
obsClient = new ObsClient(ak, sk, endPoint);
// Specify the validity period of the URL to 3,600 seconds.
longexpireSeconds = 3600L;
obsClient.putObject("bucketname", "objectname", new File("localfile"));
TemporarySignatureRequest request = new TemporarySignatureRequest(HttpMethodEnum.GET, expireSeconds);
request.setBucketName("bucketname");
request.setObjectKey("objectname");
// Obtain a temporary URL. The format of the URL is as follows:
// https://****.obs.cn-north-4.huawei.com/***.docx?AccessKeyId=***&Expires=***Signature=***
TemporarySignatureResponse response = obsClient.createTemporarySignature(request);
System.out.println("\t" + response.getSignedUrl()); Uploading a Document
For details about how to upload a document, see Uploading an Object.
Obtaining the Document URL
For details about how to obtain the document URL, see How Do I Obtain the Object URL?.
Last Article: Obtaining an Account ID
Next Article: Change History
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.