diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java index 6d237aa..fb786b6 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/ReactRotateCaptchaController.java @@ -43,7 +43,8 @@ public class ReactRotateCaptchaController { try { SecureRandom random = new SecureRandom(); double randomNumber = random.nextInt(280) + 40; - InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("image/test2.png"); + int randomImage = random.nextInt(18) + 1; + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("image/" + randomImage + ".png"); assert inputStream != null; BufferedImage image = ImageIO.read(inputStream); String token = UUID.randomUUID().toString(); diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java index 59a821d..cf6c679 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/controller/SchisandraAuthUserController.java @@ -87,7 +87,7 @@ public class SchisandraAuthUserController { return CaptchaResult.failWithCode("验证码错误,请重新验证"); } } - }else{ + } else { return CaptchaResult.fail(); } } diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/utils/CheckRouteCaptcha.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/utils/CheckRouteCaptcha.java index 34b2ef5..e752d67 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/utils/CheckRouteCaptcha.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/java/com/schisandra/auth/application/utils/CheckRouteCaptcha.java @@ -1,5 +1,6 @@ package com.schisandra.auth.application.utils; +import com.cxytiandi.encrypt.springboot.annotation.Decrypt; import com.schisandra.auth.common.entity.CaptchaResult; import com.schisandra.auth.common.redis.RedisUtil; import org.springframework.stereotype.Component; @@ -20,7 +21,6 @@ public class CheckRouteCaptcha { @Resource private RedisUtil redisUtil; public final String authRotateCaptchaPrefix = "auth.rotate.captcha"; - public CaptchaResult checkCaptcha(String token, Double deg) { if (deg == null && token == null) { return CaptchaResult.fail(); diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/1.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/1.png new file mode 100644 index 0000000..1fb8e3d Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/1.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/10.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/10.png new file mode 100644 index 0000000..6398f4b Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/10.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/11.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/11.png new file mode 100644 index 0000000..88463c7 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/11.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/12.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/12.png new file mode 100644 index 0000000..53bee9b Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/12.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/13.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/13.png new file mode 100644 index 0000000..00bdd06 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/13.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/14.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/14.png new file mode 100644 index 0000000..61768b4 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/14.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/15.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/15.png new file mode 100644 index 0000000..eed6f19 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/15.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/16.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/16.png new file mode 100644 index 0000000..804b83e Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/16.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/17.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/17.png new file mode 100644 index 0000000..4c9998d Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/17.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/18.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/18.png new file mode 100644 index 0000000..6d45524 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/18.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/test2.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/2.png similarity index 100% rename from schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/test2.png rename to schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/2.png diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/3.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/3.png new file mode 100644 index 0000000..778d376 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/3.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/4.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/4.png new file mode 100644 index 0000000..dc0eaef Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/4.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/5.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/5.png new file mode 100644 index 0000000..99a3090 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/5.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/6.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/6.png new file mode 100644 index 0000000..373e5fb Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/6.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/7.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/7.png new file mode 100644 index 0000000..9f5bd6d Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/7.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/8.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/8.png new file mode 100644 index 0000000..684a151 Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/8.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/9.png b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/9.png new file mode 100644 index 0000000..e15d30e Binary files /dev/null and b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-application/schisandra-cloud-storage-auth-application-controller/src/main/resources/image/9.png differ diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/pom.xml b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/pom.xml index 99d758a..0b2b450 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/pom.xml +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/pom.xml @@ -128,6 +128,13 @@ 0.4.20 + + + com.cxytiandi + monkey-api-encrypt-core + 1.2.2.RELEASE + + diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/CopeImageUtil.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/CopeImageUtil.java deleted file mode 100644 index 8b62e18..0000000 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-common/src/main/java/com/schisandra/auth/common/utils/CopeImageUtil.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.schisandra.auth.common.utils; - -import javax.imageio.ImageIO; -import java.awt.*; -import java.awt.geom.Ellipse2D; -import java.awt.image.BufferedImage; -import java.io.FileOutputStream; -import java.io.OutputStream; -import java.net.URL; - -/** - * @Author: EDZ - * @Description: ${description} - * @Date: 2019/5/9 13:05 - * @Version: 1.0 - */ -public class CopeImageUtil { - public static BufferedImage cutHeadImages(String headUrl) { - BufferedImage avatarImage = null; - try { - avatarImage = ImageIO.read(new URL(headUrl)); - avatarImage = scaleByPercentage(avatarImage, avatarImage.getWidth(), avatarImage.getWidth()); - int width = avatarImage.getWidth(); - // 透明底的图片 - BufferedImage formatAvatarImage = new BufferedImage(width, width, BufferedImage.TYPE_4BYTE_ABGR); - Graphics2D graphics = formatAvatarImage.createGraphics(); - //把图片切成一个园 - graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - //留一个像素的空白区域,这个很重要,画圆的时候把这个覆盖 - int border = 1; - //图片是一个圆型 - Ellipse2D.Double shape = new Ellipse2D.Double(border, border, width - border * 2, width - border * 2); - //需要保留的区域 - graphics.setClip(shape); - graphics.drawImage(avatarImage, border, border, width - border * 2, width - border * 2, null); - graphics.dispose(); - //在圆图外面再画一个圆 - //新创建一个graphics,这样画的圆不会有锯齿 - graphics = formatAvatarImage.createGraphics(); - graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - int border1 = 3; - //画笔是4.5个像素,BasicStroke的使用可以查看下面的参考文档 - //使画笔时基本会像外延伸一定像素,具体可以自己使用的时候测试 - Stroke s = new BasicStroke(5F, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND); - graphics.setStroke(s); - graphics.setColor(Color.WHITE); - graphics.drawOval(border1, border1, width - border1 * 2, width - border1 * 2); - graphics.dispose(); - OutputStream os = new FileOutputStream("E:\\Desktop\\13000.png");//发布项目时,如:Tomcat 他会在服务器本地tomcat webapps文件下创建此文件名 - ImageIO.write(formatAvatarImage, "PNG", os); - return formatAvatarImage; - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - /** - * 缩小Image,此方法返回源图像按给定宽度、高度限制下缩放后的图像 - * - * @param inputImage :压缩后宽度 - * :压缩后高度 - * @throws java.io.IOException return - */ - public static BufferedImage scaleByPercentage(BufferedImage inputImage, int newWidth, int newHeight) { - // 获取原始图像透明度类型 - try { - int type = inputImage.getColorModel().getTransparency(); - int width = inputImage.getWidth(); - int height = inputImage.getHeight(); - // 开启抗锯齿 - RenderingHints renderingHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); - // 使用高质量压缩 - renderingHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); - BufferedImage img = new BufferedImage(newWidth, newHeight, type); - Graphics2D graphics2d = img.createGraphics(); - graphics2d.setRenderingHints(renderingHints); - graphics2d.drawImage(inputImage, 0, 0, newWidth, newHeight, 0, 0, width, height, null); - graphics2d.dispose(); - return img; - - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - public static void main(String[] args) throws Exception { - cutHeadImages("https://mjmall.oss-cn-shanghai.aliyuncs.com/18/1/merchantIcon.png"); - } -} diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/java/com/schisandra/auth/AuthApplication.java b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/java/com/schisandra/auth/AuthApplication.java index e52fdd4..4820945 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/java/com/schisandra/auth/AuthApplication.java +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/java/com/schisandra/auth/AuthApplication.java @@ -1,5 +1,6 @@ package com.schisandra.auth; +import com.cxytiandi.encrypt.springboot.annotation.EnableEncrypt; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml index 607a86e..a9f4fac 100644 --- a/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml +++ b/schisandra-cloud-storage-auth/schisandra-cloud-storage-auth-starter/src/main/resources/application.yml @@ -49,6 +49,10 @@ spring: max-idle: 10 # 连接池中的最小空闲连接 min-idle: 0 + + encrypt: + key: d86d7bab3d6ac01ad9dc6a897652f2d2 + publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANUVxjcrVoirBZaNmDrUqatHEW4FOHbO5ynW6zvhIbRMo6hEFGgglbURkjuHOlgEduxJVz6Xa+sG+FMrxTguOJECAwEAAQ== logging: config: classpath:log4j2-spring.xml @@ -97,4 +101,4 @@ web: # MD5加密salt cipher: - salt: E2754BC007CA407190E85DFF6E566003 \ No newline at end of file + salt: E2754BC007CA407190E85DFF6E566003