package org.dromara.zhishu.util;

import com.aliyun.oss.common.auth.Credentials;
import com.aliyun.oss.common.auth.CredentialsProvider;
import com.aliyun.oss.common.auth.DefaultCredentials;
import com.aliyun.oss.common.auth.InvalidCredentialsException;
import com.aliyun.oss.common.utils.StringUtils;

public class EnvironmentVariableCredentialsProvider2 implements CredentialsProvider {

    public EnvironmentVariableCredentialsProvider2() {
    }

    @Override
    public void setCredentials(Credentials credentials) {

    }

    @Override
    public Credentials getCredentials() {
        String accessKeyId = "LTAI5tAsqEnyKfXngHep4X96";
        String secretAccessKey = "rO8ADdtgQ1ddp6EzJHPCvNpviGfP3r";
        String sessionToken = "";
        if (accessKeyId != null && !accessKeyId.equals("")) {
            if (secretAccessKey != null && !secretAccessKey.equals("")) {
                return new DefaultCredentials(accessKeyId, secretAccessKey, sessionToken);
            } else {
                throw new InvalidCredentialsException("Secret access key should not be null or empty.");
            }
        } else {
            throw new InvalidCredentialsException("Access key id should not be null or empty.");
        }
    }
}
