Skip to content

Commit

Permalink
Merge pull request #5 from buession/development
Browse files Browse the repository at this point in the history
release 2.1.0
  • Loading branch information
eduosi authored Aug 10, 2022
2 parents d59f013 + c0de67f commit 819ecb5
Show file tree
Hide file tree
Showing 40 changed files with 768 additions and 564 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
#- name: Autobuild
# uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -62,9 +62,11 @@ jobs:
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
- if: matrix.language == 'java'
name: Build Java
run: |
make bootstrap
make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
18 changes: 17 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
Buession Audit Changelog
Buession Cas Changelog
===========================


## [2.1.0](https://github.com/buession/buession-cas/releases/tag/v2.1.0) (2022-08-10)

### 🔨依赖升级

- [依赖库版本升级和安全漏洞修复](https://github.com/buession/buession-parent/releases/tag/v2.1.0)
- [javaparser-core](https://mvnrepository.com/artifact/com.github.javaparser/javaparser-core) 版本升级至 3.24.4


### ⭐ 新特性

- **buession-cas-support:** 增加记录用户登录日志


---


## [2.0.2](https://github.com/buession/buession-cas/releases/tag/v2.0.2) (2022-07-28)

### 🔨依赖升级
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

- 参考文档 [https://cas.buession.com/](https://cas.buession.com/)
- Wiki [https://github.com/buession/buession-cas/wiki](https://github.com/buession/buession-cas/wiki)
- API Reference [https://cas.buession.com/doc/](https://cas.buession.com/doc/)
- API Reference [https://cas.buession.com/manual/](https://cas.buession.com/manual/)

## License

Expand Down
37 changes: 11 additions & 26 deletions buession-cas-audit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.cas</groupId>
<artifactId>buession-cas-parent</artifactId>
<relativePath>../buession-cas-parent</relativePath>
<version>2.0.2</version>
<version>2.1.0</version>
</parent>
<artifactId>buession-cas-audit</artifactId>
<url>https://github.com/buession/buession-cas</url>
Expand Down Expand Up @@ -46,6 +46,11 @@
<url>https://github.com/buession/buession-cas</url>
</scm>

<issueManagement>
<system>github</system>
<url>https://github.com/buession/buession-cas/issues</url>
</issueManagement>

<dependencies>
<dependency>
<groupId>com.buession.cas</groupId>
Expand Down Expand Up @@ -121,11 +126,7 @@
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
Expand Down Expand Up @@ -200,11 +201,7 @@
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
Expand Down Expand Up @@ -299,11 +296,7 @@
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
Expand Down Expand Up @@ -394,11 +387,7 @@
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
Expand Down Expand Up @@ -489,11 +478,7 @@
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework.cloud</groupId>
Expand Down
7 changes: 6 additions & 1 deletion buession-cas-captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<groupId>com.buession.cas</groupId>
<artifactId>buession-cas-parent</artifactId>
<relativePath>../buession-cas-parent</relativePath>
<version>2.0.2</version>
<version>2.1.0</version>
</parent>
<artifactId>buession-cas-captcha</artifactId>
<url>https://github.com/buession/buession-cas</url>
Expand Down Expand Up @@ -46,6 +46,11 @@
<url>https://github.com/buession/buession-cas</url>
</scm>

<issueManagement>
<system>github</system>
<url>https://github.com/buession/buession-cas/issues</url>
</issueManagement>

<dependencies>
<dependency>
<groupId>com.buession.cas</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public class CaptchaConstants {

public final static String CAPTCHA_JAVASCRIPTS = "captchaJavaScriptUrls";

public final static String STATE_ID_VALIDATE_CAPTCHA = "validateCaptcha";

public final static String CAPTCHA_REQUIRED_EVENT = "captchaRequired";

public final static String CAPTCHA_REQUIRED_MESSAGE_CODE = "captcha.required";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ public class CaptchaProperties {

public final static String PREFIX = CasConfigurationProperties.PREFIX + ".captcha";

/**
* 是否启用验证码
*/
private boolean enabled;

/**
* 前端 JavaScript 库地址
*/
Expand All @@ -66,25 +61,6 @@ public class CaptchaProperties {
*/
private Tencent tencent;

/**
* 返回是否启用验证码
*
* @return 是否启用验证码
*/
public boolean isEnabled(){
return enabled;
}

/**
* 设置是否启用验证码
*
* @param enabled
* 是否启用验证码
*/
public void setEnabled(boolean enabled){
this.enabled = enabled;
}

/**
* 返回前端 JavaScript 库地址
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@
package org.apereo.cas.captcha.web.flow;

import org.apereo.cas.captcha.CaptchaConstants;
import org.apereo.cas.captcha.web.flow.action.InitializeCaptchaAction;
import org.apereo.cas.captcha.web.flow.action.ValidateCaptchaAction;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.web.flow.CasWebflowConfigurer;
import org.apereo.cas.web.flow.CasWebflowConstants;
import org.apereo.cas.web.flow.configurer.AbstractCasWebflowConfigurer;
import org.springframework.context.ConfigurableApplicationContext;
Expand All @@ -40,6 +43,8 @@
import java.util.List;

/**
* This is a captcha {@link CasWebflowConfigurer}.
*
* @author Yong.Teng
* @since 1.2.0
*/
Expand All @@ -62,7 +67,7 @@ protected void doInitialize(){
}

private void createInitialCaptchaAction(final Flow flow){
flow.getStartActionList().add(createEvaluateAction(CasWebflowConstants.ACTION_ID_INIT_CAPTCHA));
flow.getStartActionList().add(createEvaluateAction(InitializeCaptchaAction.NAME));
}

private void createValidateCaptchaAction(final Flow flow){
Expand All @@ -73,8 +78,9 @@ private void createValidateCaptchaAction(final Flow flow){
actionList.forEach(currentActions::add);
currentActions.forEach(actionList::remove);

actionList.add(createEvaluateAction(CasWebflowConstants.ACTION_ID_VALIDATE_CAPTCHA));
actionList.add(createEvaluateAction(ValidateCaptchaAction.NAME));
currentActions.forEach(actionList::add);

state.getTransitionSet().add(createTransition(CaptchaConstants.CAPTCHA_REQUIRED_EVENT,
CasWebflowConstants.STATE_ID_INIT_LOGIN_FORM));
state.getTransitionSet().add(createTransition(CasWebflowConstants.TRANSITION_ID_CAPTCHA_ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.buession.security.captcha.core.Manufacturer;
import org.apereo.cas.captcha.CaptchaConstants;
import org.apereo.cas.captcha.autoconfigure.CaptchaProperties;
import org.apereo.cas.web.flow.CasWebflowConstants;
import org.springframework.webflow.action.AbstractAction;
import org.springframework.webflow.core.collection.MutableAttributeMap;
import org.springframework.webflow.execution.Event;
Expand All @@ -38,6 +39,13 @@
*/
public class InitializeCaptchaAction extends AbstractAction {

/**
* Action 名称
*
* @since 2.1.0
*/
public final static String NAME = CasWebflowConstants.ACTION_ID_INIT_CAPTCHA;

private final CaptchaProperties captchaProperties;

public InitializeCaptchaAction(final CaptchaProperties captchaProperties){
Expand All @@ -52,13 +60,8 @@ protected Event doExecute(final RequestContext requestContext){
}

private void configureWebflowParameters(final RequestContext requestContext){
boolean enabled = captchaProperties.isEnabled();

if(enabled){
applyVariables(requestContext);
}

requestContext.getFlowScope().put(CaptchaConstants.ENABLE_CAPTCHA, enabled);
applyVariables(requestContext);
requestContext.getFlowScope().put(CaptchaConstants.ENABLE_CAPTCHA, true);
}

private void applyVariables(final RequestContext requestContext){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
*/
public class ValidateCaptchaAction extends AbstractAction {

/**
* Action 名称
*
* @since 2.1.0
*/
public final static String NAME = CasWebflowConstants.ACTION_ID_VALIDATE_CAPTCHA;

private final CaptchaProperties captchaProperties;

private final ServletCaptchaValidator captchaValidator;
Expand All @@ -66,8 +73,7 @@ public ValidateCaptchaAction(final CaptchaProperties captchaProperties,

@Override
protected Event doExecute(final RequestContext requestContext){
if(captchaProperties.isEnabled() == false ||
Boolean.FALSE.equals(requestContext.getFlowScope().get(CaptchaConstants.ENABLE_CAPTCHA))){
if(Boolean.FALSE.equals(requestContext.getFlowScope().get(CaptchaConstants.ENABLE_CAPTCHA))){
logger.info("Captcha is not enable.");
return null;
}
Expand Down Expand Up @@ -119,7 +125,8 @@ private Event getError(final RequestContext requestContext, final String eventId
MessageResolver messageResolver =
new MessageBuilder().error().code(messageCode).defaultText(defaultText).build();
requestContext.getMessageContext().addMessage(messageResolver);
return result(eventId);

return getEventFactorySupport().event(this, eventId);
}

}
Loading

0 comments on commit 819ecb5

Please sign in to comment.