<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[single_cong的博客]]></title><description><![CDATA[凡此过往、皆为序章]]></description><link>https://blog.csdn.net/single_cong</link><language>zh-cn</language><generator>https://blog.csdn.net/</generator><copyright><![CDATA[Copyright &copy; single_cong]]></copyright><item><title><![CDATA[MyBatis-generator高级升级]]></title><link>https://blog.csdn.net/single_cong/article/details/121307490</link><guid>https://blog.csdn.net/single_cong/article/details/121307490</guid><author>single_cong</author><pubDate>Sat, 13 Nov 2021 18:00:38 +0800</pubDate><description><![CDATA[先看兄弟篇：MyBatis-generator简单升级
目的
整合模板引擎，生成mapper、xml、entity三个类之外的其他类。
例如：


pojoInsert、pojoUpdate实体（用户更新新增接口接收参数）
使用swagger注解实现API文档自动化显示。
使用@NotBlank、@Length、@NotNull等注解实现参数校验。


service接口




接口作用
接口名
参数类型




新增
insert
pojoInsert


删除
delete
String id


更]]></description><category></category></item><item><title><![CDATA[MyBatis-generator简单升级]]></title><link>https://blog.csdn.net/single_cong/article/details/120423500</link><guid>https://blog.csdn.net/single_cong/article/details/120423500</guid><author>single_cong</author><pubDate>Wed, 22 Sep 2021 22:06:16 +0800</pubDate><description><![CDATA[目的：

生成的mapper方法名太长、我想改成自己的风格
实体类集成lombok插件，省去大量get、set方法
生成日期格式化代码：@JsonFormat(locale = "zh", timezone = "Asia/Shanghai", pattern = "yyyy-MM-dd HH:mm:ss")
实体类集成swagger，自动生成API文档
某些&lt;if test="remark != null"&gt;等判断中缺失remark != ''判断（要试自己情况决定是否使用）

实操
引入Ma]]></description><category></category></item><item><title><![CDATA[浅谈权限设计（从接口权限到数据权限）]]></title><link>https://blog.csdn.net/single_cong/article/details/120071466</link><guid>https://blog.csdn.net/single_cong/article/details/120071466</guid><author>single_cong</author><pubDate>Fri, 03 Sep 2021 00:12:45 +0800</pubDate><description><![CDATA[太久没写了，今天补一篇，本篇无实际代码，主要是设计思路。
关于JWT：在我所开发的系统中用户Token都是有意义的，都会携带部分数据，不过多用于userId
个人的权限系统使用历程：
基于Security（不加表、角色放在Token中）

注解验证（乱七八糟）
使用Spring Security框架，将用户角色ROLE_USER写在account表中，UserDetailsService的实现方法中封装UserDetails返回，然后在接口上添加注解进行权限校验
好处是简单，但是权限写在逻辑里面了。改权限就]]></description><category></category></item><item><title><![CDATA[SpringBoot日期序列化]]></title><link>https://blog.csdn.net/single_cong/article/details/112198030</link><guid>https://blog.csdn.net/single_cong/article/details/112198030</guid><author>single_cong</author><pubDate>Mon, 04 Jan 2021 20:20:14 +0800</pubDate><description><![CDATA[在一个请求中存在一个时间字段，但是前端传过来的值格式有问题，由此引出本文。
问题：

后端接收：@Data
@NoArgsConstructor
@ApiModel(value = "时间参数")
public class DateInsert {

   @ApiModelProperty(value = "时间A")
   private Date a;

   @ApiModelProperty(value = "时间B")
   private Date b;
}


前端传输：{
    "a":]]></description><category></category></item><item><title><![CDATA[微信小程序客服消息]]></title><link>https://blog.csdn.net/single_cong/article/details/107921714</link><guid>https://blog.csdn.net/single_cong/article/details/107921714</guid><author>single_cong</author><pubDate>Mon, 10 Aug 2020 21:41:03 +0800</pubDate><description><![CDATA[验签
在下面一步微信小程序后台开发设置的时候前提是此接口已经完成、否则微信小程序会验签失败！
package com.cong.controller;

import java.security.MessageDigest;
import java.util.Arrays;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframew]]></description><category></category></item><item><title><![CDATA[微信小程序登录]]></title><link>https://blog.csdn.net/single_cong/article/details/107921154</link><guid>https://blog.csdn.net/single_cong/article/details/107921154</guid><author>single_cong</author><pubDate>Mon, 10 Aug 2020 20:40:11 +0800</pubDate><description><![CDATA[微信各接口定义（残缺版）：
package com.cong.security.core.properties;

public class WXConstant {
	/** 获取access_token. */
	public static String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&amp;appid=%s&amp;secret=%s";
	/**]]></description><category></category></item><item><title><![CDATA[Apple登录]]></title><link>https://blog.csdn.net/single_cong/article/details/107618413</link><guid>https://blog.csdn.net/single_cong/article/details/107618413</guid><author>single_cong</author><pubDate>Mon, 27 Jul 2020 19:19:57 +0800</pubDate><description><![CDATA[目前的APP在苹果上如果要使用第三方登录就必须实现apple登录，本文在Spring Security的基础上整合apple登录。
苹果文档
没有例子，没有代码，是真的烦。
注意：使用苹果登录时尽量不要在登录后要求用户绑定手机号，尽量实现隐式注册的效果，否则也可能会被驳回。
代码
maven依赖
&lt;dependency&gt;
	&lt;groupId&gt;com.auth0&lt;/groupId&gt;
	&lt;artifactId&gt;jwks-rsa&lt;/artifactId&gt;]]></description><category></category></item><item><title><![CDATA[Java接口防刷策略（自定义注解实现）]]></title><link>https://blog.csdn.net/single_cong/article/details/106473582</link><guid>https://blog.csdn.net/single_cong/article/details/106473582</guid><author>single_cong</author><pubDate>Mon, 01 Jun 2020 17:48:33 +0800</pubDate><description><![CDATA[目的

短信发送及短信验证码校验接口防刷
一方面防止用户循环调用刷短信验证码
另一方面防止用户循环调用测短信验证码（一般短信验证码为6位纯数字，一秒钟上百次调用，如果不做限制很快就能试出来了）
很多接口需要防止前端重复调用
误操作多次点击，不属于攻击类型，正常用户经常会触发的，例如信息发布可能前端限制未做好，误点击了多次，这种情况实际上应该只记录第一次的，后续的不应该继续操作数据库。
极端的情况
可能很多接口一天或者很长时间只能调用一次（类似签到？个人想法是尽量不让数据到了数据库层再抛异常）

解决措施
利]]></description><category></category></item><item><title><![CDATA[Null key returned for cache operation(maybe you are using named params on classes without debug info]]></title><link>https://blog.csdn.net/single_cong/article/details/105880538</link><guid>https://blog.csdn.net/single_cong/article/details/105880538</guid><author>single_cong</author><pubDate>Tue, 05 May 2020 19:13:30 +0800</pubDate><description><![CDATA[在使用@Cacheable注解的时候遇到的这个问题
@Cacheable(value = RedisConstant.USER, key = "#id")
UserShow userShow(String id);

奇怪的是本地从没遇到过，生产上也是偶尔遇到，而@Cacheable注解肯定支持key属性，查看日志也没找到原因，最终在网上的一篇文章里面看到和debug模式有关，反射无法获取到参数值...]]></description><category></category></item><item><title><![CDATA[MyBatis返回数据库自动生成主键]]></title><link>https://blog.csdn.net/single_cong/article/details/105880758</link><guid>https://blog.csdn.net/single_cong/article/details/105880758</guid><author>single_cong</author><pubDate>Fri, 01 May 2020 18:46:34 +0800</pubDate><description><![CDATA[在部分数据库主键自动生成策略中，一些业务逻辑需要返回新增的数据标识，重查不现实，在insert的时候能够直接返回最好。MyBatis支持此种操作，只需要添加两个参数即可。


XML形式
&lt;insert id="insert" parameterType="com.test.entity.User" keyProperty="id" useGeneratedKeys="true"&gt;
	...]]></description><category></category></item><item><title><![CDATA[SpringSecurity之授权鉴权]]></title><link>https://blog.csdn.net/single_cong/article/details/104240060</link><guid>https://blog.csdn.net/single_cong/article/details/104240060</guid><author>single_cong</author><pubDate>Sun, 09 Feb 2020 20:38:08 +0800</pubDate><description><![CDATA[一般系统中区分账号角色即可，除了后台管理这类对权限要求比较复杂的。


权限表达式：



使用
一般在类上或者方法上添加注解使用（不需要对每一个接口配置权限，一般小项目用不到，只要数据库是逻辑删除可恢复这种简单的就可以使用）

在启动类上添加注解：
@EnableGlobalMethodSecurity(securedEnabled = true, jsr250Enabled = true, p...]]></description><category></category></item><item><title><![CDATA[SpringSecurity之令牌配置]]></title><link>https://blog.csdn.net/single_cong/article/details/104228206</link><guid>https://blog.csdn.net/single_cong/article/details/104228206</guid><author>single_cong</author><pubDate>Sat, 08 Feb 2020 22:50:54 +0800</pubDate><description><![CDATA[基于Oauth2发放token，在请求头中携带token作为用户身份鉴定
Token参数配置


定义可发放令牌的应用信息
package com.cong.security.core.properties;
import lombok.Data;
@Data
public class OAuth2ClientProperties {
	//应用id
	private String clientI...]]></description><category></category></item><item><title><![CDATA[SpringSecurity升级之后token刷新接口401]]></title><link>https://blog.csdn.net/single_cong/article/details/104229655</link><guid>https://blog.csdn.net/single_cong/article/details/104229655</guid><author>single_cong</author><pubDate>Sat, 08 Feb 2020 22:48:49 +0800</pubDate><description><![CDATA[在自定义的认证服务器配置类中添加如下内容
@Override
@SuppressWarnings("deprecation")
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
    security.tokenKeyAccess("permitAll()");
   ...]]></description><category></category></item><item><title><![CDATA[SpringSecurity重构登录逻辑]]></title><link>https://blog.csdn.net/single_cong/article/details/104221707</link><guid>https://blog.csdn.net/single_cong/article/details/104221707</guid><author>single_cong</author><pubDate>Sat, 08 Feb 2020 19:53:23 +0800</pubDate><description><![CDATA[将前面写的用户名密码登录、短信登录、第三方账户登录整合成OAuth2协议生成token的模式

AuthenticationSuccessHandler调用AuthorizationServerTokenServices返回令牌，AuthenticationSuccessHandler中含有Authentication信息，缺少OAuth2Request信息，组装OAuth2Request信息需要...]]></description><category></category></item><item><title><![CDATA[SpringSecurity之OAuth2]]></title><link>https://blog.csdn.net/single_cong/article/details/104212717</link><guid>https://blog.csdn.net/single_cong/article/details/104212717</guid><author>single_cong</author><pubDate>Fri, 07 Feb 2020 23:28:18 +0800</pubDate><description><![CDATA[简介### 标准的Oauth服务提供商


login模块切换至APP依赖


部分配置切换
BrowserSecurityConfig中注入的passwordEncoder转至security-core项目，否则会报错bean找不到（在配置项中注入即可，本文转移至SecurityPropertiesConfig配置项config中）

将成功失败处理器拷贝至APP项目中（处理模式不一样，无法抽象...]]></description><category></category></item><item><title><![CDATA[SpringSocial之微信登录]]></title><link>https://blog.csdn.net/single_cong/article/details/104199782</link><guid>https://blog.csdn.net/single_cong/article/details/104199782</guid><author>single_cong</author><pubDate>Thu, 06 Feb 2020 18:58:25 +0800</pubDate><description><![CDATA[编写顺序同SpringSecurity之QQ登录
创建用户信息类WeiXinUserInfo：
package com.cong.security.core.social.weixin.api;

import lombok.Data;

/**
 * 微信用户信息
 */
@Data
public class WeixinUserInfo {
	//普通用户的标识，对当前开发者帐号唯一
	pri...]]></description><category></category></item><item><title><![CDATA[SpringSocial之QQ登录]]></title><link>https://blog.csdn.net/single_cong/article/details/103966909</link><guid>https://blog.csdn.net/single_cong/article/details/103966909</guid><author>single_cong</author><pubDate>Sun, 19 Jan 2020 20:18:53 +0800</pubDate><description><![CDATA[编写顺序为：

Api
获取用户信息
Oauth2Operations
代表用户与服务提供者进行Oauth认证
ServiceProvider
服务提供商
ApiAdapter
连接统一的{@link Connection}模型和特定的提供者API模型的适配器
ConnectionFactory
构造服务提供者{@link Connection}实例的工厂的基本抽象。
创建Connection保...]]></description><category></category></item><item><title><![CDATA[Windows设置本地域名解析]]></title><link>https://blog.csdn.net/single_cong/article/details/104034069</link><guid>https://blog.csdn.net/single_cong/article/details/104034069</guid><author>single_cong</author><pubDate>Sat, 18 Jan 2020 21:38:16 +0800</pubDate><description><![CDATA[修改C:\Windows\System32\drivers\etc路径下hosts文件（管理员身份）
添加如下内容：

浏览器访问当前域名即可指向本地80端口服务。

]]></description><category></category></item><item><title><![CDATA[SpringBoot2.X版本SocialAutoConfigurerAdapter缺失造成第三方登录接口授权失败]]></title><link>https://blog.csdn.net/single_cong/article/details/104023196</link><guid>https://blog.csdn.net/single_cong/article/details/104023196</guid><author>single_cong</author><pubDate>Fri, 17 Jan 2020 18:21:39 +0800</pubDate><description><![CDATA[报错具体行为是PC端第三方登陆的链接显示未授权，跳转到自定义授权接口。
原因：

SpringBoot升级到2.X之后缺失social包，其中需要用到的是三个SocialWebAutoConfiguration、SocialAutoConfigurerAdapter以及SocialProperties，其中SocialProperties是参数配置，已经自行定义，此处不再需要，剩下的就只需要将1....]]></description><category></category></item><item><title><![CDATA[SpringSecurity之SpringSocial认知]]></title><link>https://blog.csdn.net/single_cong/article/details/103966349</link><guid>https://blog.csdn.net/single_cong/article/details/103966349</guid><author>single_cong</author><pubDate>Tue, 14 Jan 2020 01:49:59 +0800</pubDate><description><![CDATA[原理

SpringSocial将以上流程分装进入SocialAuthenticationFilter过滤器中，将该过滤器加入到spring security的过滤器链里面，如下图：

1-6步行为（服务提供商）

ServiceProvider（AbstractOAuth2ServiceProvider）
服务提供商
OAuth2Operations（OAuth2Template）
帮助完成流程...]]></description><category></category></item></channel></rss>