之前给大家介绍了sso的相关知识点和集成方案,考虑到每个系统所属行业的不同,这边针对于不同行业做了一些统一的sso单点登录界面模板,使用fileupload多文件上传+OSS阿里云存储方案。
- 阿里云oss存储Utils
public class AliyunUtils {
private static AliyunUtils aliyun;
private AliyunUtils() {
}
public static synchronized AliyunUtils getInstance(){
if(aliyun==null){
aliyun=new AliyunUtils();
}
return aliyun;
}
/**
* 上传byte数组
* @param fileByte
* @param fileKey
*/
public void uploadByte(byte[] fileByte, String fileKey){
// 创建OSSClient实例
OSSClient ossClient = new OSSClient(CloudConstant.ENDPOINT, CloudConstant.ACCESSKEYID, CloudConstant.ACCESSKEYSECRET);
// 上传byte数组
ossClient.putObject(CloudConstant.BUCKET, fileKey, new ByteArrayInputStream(fileByte));
// 关闭client
ossClient.shutdown();
}