1.1.9 下放私有参数给子类

This commit is contained in:
maxf 2018-11-23 11:16:22 +08:00
parent e1ea387530
commit 02d4a44efc
7 changed files with 30 additions and 30 deletions

View File

@ -1,7 +1,7 @@
yexuejc-springboot 更新内容
-------------------
#### version 1.1.6-1.1.8
#### version 1.1.6-1.1.9
**time2018-11-21 15:03:01** <br/>
**branch** master <br/>
**关联工程:** <br/>

View File

@ -5,7 +5,7 @@
<groupId>com.yexuejc.springboot</groupId>
<artifactId>yexuejc-springboot-parent</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>

View File

@ -9,7 +9,7 @@
<parent>
<groupId>com.yexuejc.springboot</groupId>
<artifactId>yexuejc-springboot-parent</artifactId>
<version>1.1.8</version>
<version>1.1.9</version>
<!-- 本地打包:使用相对关联路径 -->
<!--<relativePath>../../yexuejc</relativePath>-->
</parent>

View File

@ -20,37 +20,37 @@ public class ConsumerAuthenticationProcessingFilter extends AbstractAuthenticati
// ~ Static fields/initializers
// =====================================================================================
public static final String SPRING_SECURITY_FORM_USERNAME_KEY = "username";
public static final String SPRING_SECURITY_FORM_PASSWORD_KEY = "password";
protected static final String SPRING_SECURITY_FORM_USERNAME_KEY = "username";
protected static final String SPRING_SECURITY_FORM_PASSWORD_KEY = "password";
/**
* 登录方式
*/
public static final String SPRING_SECURITY_FORM_LOGTYPE_KEY = "logtype";
public static final String SPRING_SECURITY_FORM_OPENID_KEY = "openid";
protected static final String SPRING_SECURITY_FORM_LOGTYPE_KEY = "logtype";
protected static final String SPRING_SECURITY_FORM_OPENID_KEY = "openid";
/********************************** 第三方登录时附带信息*************************************/
/**
* 头像
*/
public static final String SPRING_SECURITY_FORM_HEAD_KEY = "head";
protected static final String SPRING_SECURITY_FORM_HEAD_KEY = "head";
/**
* 昵称
*/
public static final String SPRING_SECURITY_FORM_NICKNAME_KEY = "nickname";
protected static final String SPRING_SECURITY_FORM_NICKNAME_KEY = "nickname";
/**
* 性别
*/
public static final String SPRING_SECURITY_FORM_SEX_KEY = "sex";
protected static final String SPRING_SECURITY_FORM_SEX_KEY = "sex";
/********************************** 第三方登录时附带信息*************************************/
private String usernameParameter = SPRING_SECURITY_FORM_USERNAME_KEY;
private String passwordParameter = SPRING_SECURITY_FORM_PASSWORD_KEY;
private String logtypeParameter = SPRING_SECURITY_FORM_LOGTYPE_KEY;
private String openidParameter = SPRING_SECURITY_FORM_OPENID_KEY;
private String headParameter = SPRING_SECURITY_FORM_HEAD_KEY;
private String nicknameParameter = SPRING_SECURITY_FORM_NICKNAME_KEY;
private String sexParameter = SPRING_SECURITY_FORM_SEX_KEY;
private boolean postOnly = true;
private boolean reverse = true;
protected String usernameParameter = SPRING_SECURITY_FORM_USERNAME_KEY;
protected String passwordParameter = SPRING_SECURITY_FORM_PASSWORD_KEY;
protected String logtypeParameter = SPRING_SECURITY_FORM_LOGTYPE_KEY;
protected String openidParameter = SPRING_SECURITY_FORM_OPENID_KEY;
protected String headParameter = SPRING_SECURITY_FORM_HEAD_KEY;
protected String nicknameParameter = SPRING_SECURITY_FORM_NICKNAME_KEY;
protected String sexParameter = SPRING_SECURITY_FORM_SEX_KEY;
protected boolean postOnly = true;
protected boolean reverse = true;
// ~ Constructors
// ===================================================================================================

View File

@ -51,12 +51,12 @@ public class ConsumerAuthenticationProvider extends AbstractUserDetailsAuthentic
* PasswordEncoder#matches(CharSequence, String)} on when the user is
* not found to avoid SEC-2056.
*/
private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
protected static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
// ~ Instance fields
// ================================================================================================
private PasswordEncoder passwordEncoder;
protected PasswordEncoder passwordEncoder;
/**
* The password used to perform
@ -65,10 +65,10 @@ public class ConsumerAuthenticationProvider extends AbstractUserDetailsAuthentic
* {@link PasswordEncoder} implementations will short circuit if the password is not
* in a valid format.
*/
private volatile String userNotFoundEncodedPassword;
protected volatile String userNotFoundEncodedPassword;
private UserDetailsService userDetailsService;
private final UserService accountView;
protected UserDetailsService userDetailsService;
protected final UserService accountView;
public ConsumerAuthenticationProvider(UserDetailsService userDetailsService, UserService accountView) {
@ -263,13 +263,13 @@ public class ConsumerAuthenticationProvider extends AbstractUserDetailsAuthentic
}
}
private void prepareTimingAttackProtection() {
protected void prepareTimingAttackProtection() {
if (this.userNotFoundEncodedPassword == null) {
this.userNotFoundEncodedPassword = this.passwordEncoder.encode(USER_NOT_FOUND_PASSWORD);
}
}
private void mitigateAgainstTimingAttack(UsernamePasswordAuthenticationToken authentication) {
protected void mitigateAgainstTimingAttack(UsernamePasswordAuthenticationToken authentication) {
if (authentication.getCredentials() != null) {
String presentedPassword = authentication.getCredentials().toString();
this.passwordEncoder.matches(presentedPassword, "{MD5}" + this.userNotFoundEncodedPassword);

View File

@ -34,10 +34,10 @@ import java.util.Map;
*/
public class ConsumerSecurityContextRepository implements SecurityContextRepository {
protected final Log logger = LogFactory.getLog(this.getClass());
private static final String TOKEN = "token";
private static final String ROLES = "roles";
protected static final String TOKEN = "token";
protected static final String ROLES = "roles";
private final RedisTemplate<Object, Object> redisTemplate0;
protected final RedisTemplate<Object, Object> redisTemplate0;
public ConsumerSecurityContextRepository(RedisTemplate<Object, Object> redisTemplate0) {
this.redisTemplate0 = redisTemplate0;

View File

@ -24,7 +24,7 @@ import java.util.List;
*/
public class UserDetailsManager extends InMemoryUserDetailsManager {
private final UserService userService;
protected final UserService userService;
public UserDetailsManager(UserService userService) {
this.userService = userService;