diff --git a/pom.xml b/pom.xml index 63aa70ecb..29f18bfc6 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,7 @@ yudao-module-pay yudao-module-mall yudao-module-visualization + yudao-example ${project.artifactId} diff --git a/yudao-example/pom.xml b/yudao-example/pom.xml new file mode 100644 index 000000000..588b86387 --- /dev/null +++ b/yudao-example/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + + + cn.iocoder.boot + yudao-example + 1.0.0-snapshot + pom + + yudao-sso-demo-by-code + + + ${project.artifactId} + 提供各种示例,例如说:SSO 单点登录 + https://github.com/YunaiV/ruoyi-vue-pro + + diff --git a/yudao-example/yudao-sso-demo-by-code/pom.xml b/yudao-example/yudao-sso-demo-by-code/pom.xml new file mode 100644 index 000000000..0227d37c3 --- /dev/null +++ b/yudao-example/yudao-sso-demo-by-code/pom.xml @@ -0,0 +1,53 @@ + + + 4.0.0 + + + + cn.iocoder.boot + yudao-sso-demo-by-code + 1.0.0-snapshot + jar + + ${project.artifactId} + 基于授权码模式,如何实现 SSO 单点登录? + https://github.com/YunaiV/ruoyi-vue-pro + + + + 8 + 8 + UTF-8 + + 2.6.10 + + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring.boot.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-security + + + + diff --git a/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/SSODemoApplication.java b/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/SSODemoApplication.java new file mode 100644 index 000000000..f6b160745 --- /dev/null +++ b/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/SSODemoApplication.java @@ -0,0 +1,13 @@ +package cn.iocoder.yudao.ssodemo; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class SSODemoApplication { + + public static void main(String[] args) { + SpringApplication.run(SSODemoApplication.class, args); + } + +} diff --git a/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/controller/AuthController.java b/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/controller/AuthController.java new file mode 100644 index 000000000..8445ff288 --- /dev/null +++ b/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/controller/AuthController.java @@ -0,0 +1,14 @@ +package cn.iocoder.yudao.ssodemo.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; + +@Controller("/auth") +public class AuthController { + + @PostMapping("/login-by-code") + public void loginByCode() { + + } + +} diff --git a/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/SecurityConfiguration.java b/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/SecurityConfiguration.java new file mode 100644 index 000000000..9e925913a --- /dev/null +++ b/yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/SecurityConfiguration.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.ssodemo.framework; + +import org.springframework.context.annotation.Configuration; +import org.springframework.http.HttpMethod; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +public class SecurityConfiguration extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity httpSecurity) throws Exception { + httpSecurity.authorizeRequests() + // 1. 静态资源,可匿名访问 + .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() + // last. 兜底规则,必须认证 + .and().authorizeRequests() + .anyRequest().authenticated(); + } +} diff --git a/yudao-example/yudao-sso-demo-by-code/src/main/resources/application.yaml b/yudao-example/yudao-sso-demo-by-code/src/main/resources/application.yaml new file mode 100644 index 000000000..a62cf97dc --- /dev/null +++ b/yudao-example/yudao-sso-demo-by-code/src/main/resources/application.yaml @@ -0,0 +1,2 @@ +server: + port: 18080 diff --git a/yudao-example/yudao-sso-demo-by-code/src/main/resources/static/login.html b/yudao-example/yudao-sso-demo-by-code/src/main/resources/static/login.html new file mode 100644 index 000000000..b468d84f1 --- /dev/null +++ b/yudao-example/yudao-sso-demo-by-code/src/main/resources/static/login.html @@ -0,0 +1,34 @@ + + + + + 首页 + + + + + + + + + +
+ 您未登录,点击 跳转 SSO 单点登录 +
+ + + + diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/TenantPackageDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/TenantPackageDO.java index 430c3a080..dba7569af 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/TenantPackageDO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/TenantPackageDO.java @@ -34,7 +34,7 @@ public class TenantPackageDO extends BaseDO { */ private String name; /** - * 租户状态 + * 租户套餐状态 * * 枚举 {@link CommonStatusEnum} */