Commit 108015fc by chentianzhong

11111111111111111111

parent ea60d9f8
...@@ -16,7 +16,12 @@ ...@@ -16,7 +16,12 @@
<version>${springboot.version}</version> <version>${springboot.version}</version>
<configuration> <configuration>
<mainClass>org.springframework.boot.loader.WarLauncher</mainClass> <mainClass>org.springframework.boot.loader.WarLauncher</mainClass>
<addResources>true</addResources> <addResources>true</addResources> <excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
...@@ -81,28 +86,6 @@ ...@@ -81,28 +86,6 @@
<artifactId>cas-server-webapp${app.server}</artifactId> <artifactId>cas-server-webapp${app.server}</artifactId>
<version>${cas.version}</version> <version>${cas.version}</version>
<type>war</type> <type>war</type>
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-api</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-core</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-jcl</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>org.apache.logging.log4j</groupId>-->
<!-- <artifactId>log4j-web</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
...@@ -146,11 +129,52 @@ ...@@ -146,11 +129,52 @@
<version>${cas.version}</version> <version>${cas.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!--
https://blog.csdn.net/qq_34021712/article/details/81544181
开启rest认证
cas服务端通过调用其他服务接口,将用户名和密码传过去进行认证。这就是rest认证。
什么情况下需要用到Rest认证?
在不允许cas服务直接访问账号数据库的时候,这个时候就需要用到Rest认证。
流程:
当用户点击登录后,cas会发送post请求到http://rest.cas.com:8083/login并且把用户信息以"用户名:密码"进行Base64编码放在authorization请求头中。
若输入用户名密码为:admin/123456;那么请求头包括:
authorization=Basic Base64(admin+MD5(123))
那么发送后客户端必须响应一下数据,cas明确规定如下:
● cas 服务端会通过post请求,并且把用户信息以”用户名:密码”进行Base64编码放在authorization请求头中
● 200状态码:并且格式为
{“@class”:”org.apereo.cas.authentication.principal.SimplePrincipal”,”id”:”casuser”,”attributes”:{}}是成功的
● 403状态码:用户不可用
● 404状态码:账号不存在
● 423状态码:账户被锁定
● 428状态码:过期
● 其他登录失败
-->
<!-- <dependency>-->
<!-- <groupId>org.apereo.cas</groupId>-->
<!-- <artifactId>cas-server-support-rest-authentication</artifactId>-->
<!-- <version>${cas.version}</version>-->
<!-- </dependency>-->
<!-- Restful support -->
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-rest</artifactId>
<version>${cas.version}</version>
</dependency>
<!--连接池 --> <!--连接池 -->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>druid</artifactId> <artifactId>druid-spring-boot-starter</artifactId>
<version>1.0.28</version> <version>${druid.version}</version>
</dependency>
<!--Mybatis plus-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version>
</dependency> </dependency>
<!--mysql --> <!--mysql -->
<dependency> <dependency>
...@@ -213,16 +237,19 @@ ...@@ -213,16 +237,19 @@
</dependency> </dependency>
<!--北京CA-->
<dependency> <dependency>
<groupId>org.bjca</groupId> <groupId>org.bjca</groupId>
<artifactId>svs-client</artifactId> <artifactId>svs-client</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/SVSClient.jar</systemPath>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bjca</groupId> <groupId>org.bjca</groupId>
<artifactId>bjca-log</artifactId> <artifactId>bjca-log</artifactId>
<version>1.0.0</version> <version>1.0.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/BJCA_LOG.jar</systemPath>
</dependency> </dependency>
</dependencies> </dependencies>
...@@ -234,6 +261,8 @@ ...@@ -234,6 +261,8 @@
<maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<druid.version>1.2.2</druid.version>
<mybatis.plus.version>3.4.0</mybatis.plus.version>
</properties> </properties>
<repositories> <repositories>
......
package com.zq.cas.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;
import javax.sql.DataSource;
import java.sql.SQLException;
/**
* Created by Chen Tianzhong in 2021/6/20
* 相当于之前的ApplicationContext-Dao.xml
* 配置数据源,使用阿里Druid数据源
*
*/
@Configuration
public class DataSourceConfig {
/**
* 数据源驱动类型
*/
@Value("${jdbc.ds.driverClassName}")
private String driver;
/**
* 连接地址
*/
@Value("${jdbc.ds.url}")
private String url;
/**
* 用户名
*/
@Value("${jdbc.ds.username}")
private String username;
/**
* 密码
*/
@Value("${jdbc.ds.password}")
private String password;
/**
* 配置Druid数据源
* @return
* @throws SQLException
*/
@Bean(name="dataSource")
public DataSource dataSource() throws SQLException{
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(driver);
dataSource.setUrl(url);
dataSource.setUsername(username);
dataSource.setPassword(password);
//配置最大连接
dataSource.setMaxActive(20);
//配置初始连接
dataSource.setInitialSize(5);
//配置最小连接
dataSource.setMinIdle(10);
//连接等待超时时间
dataSource.setMaxWait(60000);
//间隔多久进行检测,关闭空闲连接
dataSource.setTimeBetweenEvictionRunsMillis(60000);
//一个连接最小生存时间
dataSource.setMinEvictableIdleTimeMillis(300000);
dataSource.setMaxEvictableIdleTimeMillis(900000);
//连接等待超时时间 单位为毫秒 缺省启用公平锁,
//并发效率会有所下降, 如果需要可以通过配置useUnfairLock属性为true使用非公平锁
// dataSource.setUseUnfairLock(true);
//用来检测是否有效的sql
dataSource.setValidationQuery("select 1");
dataSource.setTestWhileIdle(true);
//申请连接时执行validationQuery检测连接是否有效,配置为true会降低性能
dataSource.setTestOnBorrow(false);
//归还连接时执行validationQuery检测连接是否有效,配置为true会降低性能
dataSource.setTestOnReturn(false);
return dataSource;
}
@Bean(name = "jdbcTemplate")
public JdbcTemplate jdbcTemplate(@Qualifier("dataSource") DataSource dataSource){
JdbcTemplate jdbcTemplate = new JdbcTemplate();
jdbcTemplate.setDataSource(dataSource);
return jdbcTemplate;
}
}
...@@ -2,12 +2,12 @@ package com.zq.cas.config; ...@@ -2,12 +2,12 @@ package com.zq.cas.config;
import cn.org.bjca.client.security.SecurityEngineDeal; import cn.org.bjca.client.security.SecurityEngineDeal;
import com.zq.cas.handler.MyAuthenticationHandler; import com.zq.cas.handler.MyAuthenticationHandler;
import com.zq.cas.service.LoginCountService; import com.zq.cas.handler.MyUsernameAndPasswordAuthenticationHandler;
import com.zq.cas.service.LoginDetailService; import com.zq.cas.service.ISysUserService;
import com.zq.cas.service.UserService;
import org.apereo.cas.authentication.AuthenticationEventExecutionPlan; import org.apereo.cas.authentication.AuthenticationEventExecutionPlan;
import org.apereo.cas.authentication.AuthenticationEventExecutionPlanConfigurer; import org.apereo.cas.authentication.AuthenticationEventExecutionPlanConfigurer;
import org.apereo.cas.authentication.AuthenticationHandler; import org.apereo.cas.authentication.AuthenticationHandler;
import org.apereo.cas.authentication.DefaultAuthenticationHandlerResolver;
import org.apereo.cas.authentication.principal.DefaultPrincipalFactory; import org.apereo.cas.authentication.principal.DefaultPrincipalFactory;
import org.apereo.cas.configuration.CasConfigurationProperties; import org.apereo.cas.configuration.CasConfigurationProperties;
import org.apereo.cas.services.ServicesManager; import org.apereo.cas.services.ServicesManager;
...@@ -34,18 +34,8 @@ public class MyAuthenticationConfiguration implements AuthenticationEventExecuti ...@@ -34,18 +34,8 @@ public class MyAuthenticationConfiguration implements AuthenticationEventExecuti
//@Qualifier("servicesManager") //@Qualifier("servicesManager")
@Resource @Resource
private ServicesManager servicesManager; private ServicesManager servicesManager;
@Resource
private UserService userService;
@Resource
private LoginDetailService loginDetailService;
@Resource
private LoginCountService loginCountService;
@Resource @Resource
private SecurityEngineDeal securityEngineDeal; private ISysUserService sysUserService;
// @Resource
// private CaUserDao caUserDao;
/** /**
* 将自定义验证器注册为Bean * 将自定义验证器注册为Bean
...@@ -54,14 +44,29 @@ public class MyAuthenticationConfiguration implements AuthenticationEventExecuti ...@@ -54,14 +44,29 @@ public class MyAuthenticationConfiguration implements AuthenticationEventExecuti
*/ */
@Bean @Bean
public AuthenticationHandler myAuthenticationHandler() { public AuthenticationHandler myAuthenticationHandler() {
// MyAuthenticationHandler handler1 =
// new CustomUsernamePasswordAuthentication(MyAuthenticationHandler.class.getSimpleName(),
// servicesManager, new DefaultPrincipalFactory(), 1);
MyAuthenticationHandler handler = MyAuthenticationHandler handler =
new MyAuthenticationHandler(MyAuthenticationHandler.class.getSimpleName(), new MyAuthenticationHandler(MyAuthenticationHandler.class.getSimpleName(),
servicesManager, new DefaultPrincipalFactory(), 1); servicesManager, new DefaultPrincipalFactory(), 10);
handler.setUserService(userService); handler.setSysUserService(sysUserService);
handler.setLoginCountService(loginCountService); return handler;
handler.setLoginDetailService(loginDetailService); }
handler.setSecurityEngineDeal(securityEngineDeal);
//handler.setCaUserDao(caUserDao); @Bean
public AuthenticationHandler myUsernameAndPasswordAuthenticationHandler() {
// MyAuthenticationHandler handler1 =
// new CustomUsernamePasswordAuthentication(MyAuthenticationHandler.class.getSimpleName(),
// servicesManager, new DefaultPrincipalFactory(), 1);
MyUsernameAndPasswordAuthenticationHandler handler =
new MyUsernameAndPasswordAuthenticationHandler(MyAuthenticationHandler.class.getSimpleName(),
servicesManager, new DefaultPrincipalFactory(), 9);
handler.setSysUserService(sysUserService);
return handler; return handler;
} }
...@@ -71,6 +76,7 @@ public class MyAuthenticationConfiguration implements AuthenticationEventExecuti ...@@ -71,6 +76,7 @@ public class MyAuthenticationConfiguration implements AuthenticationEventExecuti
*/ */
@Override @Override
public void configureAuthenticationExecutionPlan(AuthenticationEventExecutionPlan plan) { public void configureAuthenticationExecutionPlan(AuthenticationEventExecutionPlan plan) {
plan.registerAuthenticationHandler(myUsernameAndPasswordAuthenticationHandler());
plan.registerAuthenticationHandler(myAuthenticationHandler()); plan.registerAuthenticationHandler(myAuthenticationHandler());
} }
} }
...@@ -29,22 +29,15 @@ public class MytLoginWebflowConfigurer extends DefaultLoginWebflowConfigurer { ...@@ -29,22 +29,15 @@ public class MytLoginWebflowConfigurer extends DefaultLoginWebflowConfigurer {
final ViewState state = getState(flow, CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM, ViewState.class); final ViewState state = getState(flow, CasWebflowConstants.STATE_ID_VIEW_LOGIN_FORM, ViewState.class);
final BinderConfiguration cfg = getViewStateBinderConfiguration(state); final BinderConfiguration cfg = getViewStateBinderConfiguration(state);
cfg.addBinding(new BinderConfiguration.Binding("rememberMe", null, false)); cfg.addBinding(new BinderConfiguration.Binding("rememberMe", null, false));
cfg.addBinding(new BinderConfiguration.Binding("captcha", null, true));
}else{ }else{
//主要修改了这里,替换成我们自己定义的MyUsernamePasswordCredential //主要修改了这里,替换成我们自己定义的MyUsernamePasswordCredential
//并且加上loginType、rememberUserName、fstLogin的绑定 //并且加上loginType、rememberUserName、fstLogin的绑定
createFlowVariable(flow, "credential", MyUsernamePasswordCredential.class); createFlowVariable(flow, "credential", MyUsernamePasswordCredential.class);
ViewState state = (ViewState) this.getState(flow, "viewLoginForm", ViewState.class); ViewState state = (ViewState) this.getState(flow, "viewLoginForm", ViewState.class);
BinderConfiguration cfg = this.getViewStateBinderConfiguration(state); BinderConfiguration cfg = this.getViewStateBinderConfiguration(state);
cfg.addBinding(new BinderConfiguration.Binding("username", (String) null, false)); cfg.addBinding(new BinderConfiguration.Binding("username", (String) null, true));
cfg.addBinding(new BinderConfiguration.Binding("password", (String) null, false)); cfg.addBinding(new BinderConfiguration.Binding("password", (String) null, true));
cfg.addBinding(new BinderConfiguration.Binding("loginType", (String) null, false)); cfg.addBinding(new BinderConfiguration.Binding("loginType", (String) null, true));
cfg.addBinding(new BinderConfiguration.Binding("caType", (String) null, false));
cfg.addBinding(new BinderConfiguration.Binding("userSignedData", (String) null, false));
cfg.addBinding(new BinderConfiguration.Binding("userCert", (String) null, false));
cfg.addBinding(new BinderConfiguration.Binding("containerName", (String) null, false));
cfg.addBinding(new BinderConfiguration.Binding("random", (String) null, false));
cfg.addBinding(new BinderConfiguration.Binding("caPwd", (String) null, false));
} }
} }
} }
...@@ -4,6 +4,8 @@ import cn.org.bjca.client.exceptions.ApplicationNotFoundException; ...@@ -4,6 +4,8 @@ import cn.org.bjca.client.exceptions.ApplicationNotFoundException;
import cn.org.bjca.client.exceptions.InitException; import cn.org.bjca.client.exceptions.InitException;
import cn.org.bjca.client.exceptions.SVSConnectException; import cn.org.bjca.client.exceptions.SVSConnectException;
import cn.org.bjca.client.security.SecurityEngineDeal; import cn.org.bjca.client.security.SecurityEngineDeal;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -15,12 +17,17 @@ import org.springframework.context.annotation.Configuration; ...@@ -15,12 +17,17 @@ import org.springframework.context.annotation.Configuration;
*/ */
@Configuration @Configuration
@ComponentScan("com.zq.cas") @ComponentScan("com.zq.cas")
@MapperScan("com.zq.cas.mapper")
public class SpringConfig { public class SpringConfig {
@Value("${ca.svs.root}")
private String svsRoot;
@Bean @Bean
public SecurityEngineDeal securityEngineDeal() throws ApplicationNotFoundException, InitException, SVSConnectException { public SecurityEngineDeal securityEngineDeal() throws ApplicationNotFoundException, InitException, SVSConnectException {
SecurityEngineDeal.setProfilePath("/data/DSVSROOT"); //SecurityEngineDeal.setProfilePath("/data/DSVSROOT");
//SecurityEngineDeal.setProfilePath("C:\\DSVSROOT"); SecurityEngineDeal.setProfilePath(svsRoot);
SecurityEngineDeal svsDefault = SecurityEngineDeal.getInstance("SVSDefault"); SecurityEngineDeal svsDefault = SecurityEngineDeal.getInstance("SVSDefault");
return svsDefault; return svsDefault;
} }
......
package com.zq.cas.config;
import com.zq.cas.handler.URLInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.format.FormatterRegistry;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.validation.MessageCodesResolver;
import org.springframework.validation.Validator;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.HandlerMethodReturnValueHandler;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.config.annotation.*;
import java.util.List;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void configurePathMatch(PathMatchConfigurer pathMatchConfigurer) {
}
@Override
public void configureContentNegotiation(ContentNegotiationConfigurer contentNegotiationConfigurer) {
}
@Override
public void configureAsyncSupport(AsyncSupportConfigurer asyncSupportConfigurer) {
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer defaultServletHandlerConfigurer) {
}
@Override
public void addFormatters(FormatterRegistry formatterRegistry) {
}
@Override
public void addInterceptors(InterceptorRegistry interceptorRegistry) {
interceptorRegistry.addInterceptor(new URLInterceptor()).addPathPatterns("/**");
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry resourceHandlerRegistry) {
}
@Override
public void addCorsMappings(CorsRegistry corsRegistry) {
}
@Override
public void addViewControllers(ViewControllerRegistry viewControllerRegistry) {
}
@Override
public void configureViewResolvers(ViewResolverRegistry viewResolverRegistry) {
}
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> list) {
}
@Override
public void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> list) {
}
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> list) {
}
@Override
public void extendMessageConverters(List<HttpMessageConverter<?>> list) {
}
@Override
public void configureHandlerExceptionResolvers(List<HandlerExceptionResolver> list) {
}
@Override
public void extendHandlerExceptionResolvers(List<HandlerExceptionResolver> list) {
}
@Override
public Validator getValidator() {
return null;
}
@Override
public MessageCodesResolver getMessageCodesResolver() {
return null;
}
}
package com.zq.cas.controller;
import cn.org.bjca.client.security.SecurityEngineDeal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;
/**
* @author wilmiam
* @since 2021/12/25 14:23
*/
@RequestMapping("/caAuth")
@RestController
public class BjcaController {
@Autowired
private SecurityEngineDeal securityEngineDeal;
@PostMapping("/getCaParam")
public Object getParams() {
Map<String, Object> map = new HashMap<>();
try {
String strServerCert = securityEngineDeal.getServerCertificate();
String strRandom = securityEngineDeal.genRandom(24);
String strSignedData = securityEngineDeal.signData(strRandom.getBytes());
map.put("success", true);
Map<String, Object> data = new HashMap<>();
data.put("strServerCert", strServerCert);
data.put("strServerRan", strRandom);
data.put("strServerSignedData", strSignedData);
map.put("data", data);
} catch (Exception e) {
map.put("success", false);
map.put("errMag", e.getLocalizedMessage());
}
return map;
}
}
package com.zq.cas.controller;
import cn.org.bjca.client.security.SecurityEngineDeal;
import com.zq.cas.entity.SysUser;
import com.zq.cas.service.ISysUserService;
import com.zq.cas.util.MD5PasswordEncoderUtil;
import com.zq.cas.vo.UserCertVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@RequestMapping("/ca")
@RestController
@Slf4j
public class CAVerifyController {
@Resource
private SecurityEngineDeal securityEngineDeal;
@Resource
private ISysUserService sysUserService;
@GetMapping("/param")
public Object param() {
Map<String, Object> map = new HashMap<>();
try {
String strServerCert = securityEngineDeal.getServerCertificate();
String strRandom = securityEngineDeal.genRandom(24);
String strSignedData = securityEngineDeal.signData(strRandom.getBytes());
map.put("success", true);
map.put("strServerCert", strServerCert);
map.put("strServerRan", strRandom);
map.put("strServerSignedData", strSignedData);
} catch (Exception e) {
map.put("success", false);
map.put("errMsg", e.getLocalizedMessage());
}
return map;
}
@PostMapping("/verify")
public Object verify(UserCertVo vo) {
Map<String, Object> map = new HashMap<>();
map.put("success", false);
try {
//verifySignedData
byte[] signedByte = securityEngineDeal.base64Decode(vo.getUserSignedData());
boolean vres = securityEngineDeal.verifySignedData(vo.getUserCert(), vo.getStrServerRan().getBytes(), signedByte);
if (!vres) {
map.put("errMsg", "证书识别错误, 刷新页面重试后联系管理员!verifySignedData is false.");
return map;
}
//验证客户端证书
int retValue = securityEngineDeal.validateCert(vo.getUserCert());
if (retValue != 1) {
map.put("errMsg", "证书识别错误, 刷新页面重试后联系管理员!validateCert is false.");
return map;
}
//获取唯一标识判断用户
String strCertEntityID = securityEngineDeal.getCertInfoByOid(vo.getUserCert(), "2.16.840.1.113732.2");
if (strCertEntityID != null && !strCertEntityID.isEmpty() && strCertEntityID.contains("SF")) {
strCertEntityID = strCertEntityID.substring(2);
}
log.info("用户身份标识[strCertEntityID]: " + strCertEntityID);
SysUser user = sysUserService.findByIdCard(strCertEntityID);
if (user!=null){
if (vo.getLoginType().trim().equals("2")){
map.put("success", true);
map.put("username", user.getUsername());
map.put("password", "8888");
}else{
String username = vo.getUsername().trim();
if (!username.contains("@gxfy.com")){
username += "@gxfy.com";
}
if (user.getUsername().equals(username)){
map.put("success", true);
map.put("username", user.getUsername());
map.put("password", "8888");
}else{
map.put("errMsg", "证书和用户不匹配!");
}
}
}else{
map.put("errMsg", "身份标识:"+strCertEntityID+"用户为空");
}
} catch (Exception e) {
map.put("success", false);
map.put("errMsg", e.getLocalizedMessage());
}
return map;
}
}
package com.zq.cas.controller;
import com.zq.cas.util.OmnipotentPassword;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/password")
@RestController
public class PassController {
@GetMapping
public String password() {
return OmnipotentPassword.password();
}
}
//package com.zq.cas.controller;
//
//import com.zq.cas.entity.SysUser;
//import com.zq.cas.service.ISysUserService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.util.Base64Utils;
//import org.springframework.util.StringUtils;
//import org.springframework.web.bind.annotation.RequestHeader;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.io.UnsupportedEncodingException;
//
///**
// * @author: wangsaichao
// * @date: 2018/8/1
// * @description: 对比用户信息
// */
//@RestController
//public class UserController {
//
// private static final Logger logger = LoggerFactory.getLogger(UserController.class);
//
// @Resource
// private ISysUserService sysUserService;
//
// /**
// * 1. cas 服务端会通过post请求,并且把用户信息以"用户名:密码"进行Base64编码放在authorization请求头中
// * 2. 返回200状态码并且格式为{"@class":"org.apereo.cas.authentication.principal.SimplePrincipal","id":"casuser","attributes":{}} 是成功的
// * 2. 返回状态码403用户不可用;404账号不存在;423账户被锁定;428过期;其他登录失败
// * @param httpHeaders
// * @return
// */
// @RequestMapping("/login")
// public Object login(@RequestHeader HttpHeaders httpHeaders){
//
// logger.info("开始验证服务");
//
// SysUser user = null;
// try {
// UserTemp userTemp = obtainUserFormHeader(httpHeaders);
// if (userTemp != null && StringUtils.hasText(user.getUsername()) && StringUtils.hasText(user.getPassword()) ){
// //尝试查找用户库是否存在
// user = sysUserService.findByUsername(userTemp.username);
// if (user != null) {
// if (!user.getPassword().equals(userTemp.password)) {
// //密码不匹配
// return new ResponseEntity(HttpStatus.BAD_REQUEST);
// }
// } else {
// return new ResponseEntity(HttpStatus.NOT_FOUND);
// }
// }
// } catch (UnsupportedEncodingException e) {
// logger.error("用户认证错误", e);
// new ResponseEntity(HttpStatus.BAD_REQUEST);
// }
// //成功返回json
// return user;
// }
//
// /**
// * This allows the CAS server to reach to a remote REST endpoint via a POST for verification of credentials.
// * Credentials are passed via an Authorization header whose value is Basic XYZ where XYZ is a Base64 encoded version of the credentials.
// * @param httpHeaders
// * @return
// * @throws UnsupportedEncodingException
// */
// private UserTemp obtainUserFormHeader(HttpHeaders httpHeaders) throws UnsupportedEncodingException {
//
// //cas服务端会通过把用户信息放在请求头authorization中,并且通过Basic认证方式加密
// String authorization = httpHeaders.getFirst("authorization");
// if(StringUtils.isEmpty(authorization)){
// return null;
// }
//
// String baseCredentials = authorization.split(" ")[1];
// //用户名:密码
// String usernamePassword = new String(Base64Utils.decodeFromString(baseCredentials), "UTF-8");
// String[] credentials = usernamePassword.split(":");
//
// return new UserTemp(credentials[0], credentials[1]);
// }
//
// /**
// * 从请求头中获取用户名和密码
// */
// private class UserTemp {
// private String username;
// private String password;
//
// public UserTemp(String username, String password) {
// this.username = username;
// this.password = password;
// }
// }
//
//
//
//}
\ No newline at end of file
package com.zq.cas.controller;
import com.zq.cas.entity.SysUser;
import com.zq.cas.service.ISysUserService;
import com.zq.cas.util.MD5PasswordEncoderUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@RequestMapping("/user")
@RestController
@Slf4j
public class UserVerifyController {
@Resource
private ISysUserService sysUserService;
@GetMapping("/verify")
public Object verify(@RequestParam("username") String username,
@RequestParam("password") String password) {
Map<String, Object> map = new HashMap<>();
map.put("success", false);
try {
password = MD5PasswordEncoderUtil.encode(password);
SysUser sysUser = sysUserService.findByUsernameAndPwd(username, password);
if (sysUser !=null){
map.put("success", true);
map.put("data", sysUser);
}
} catch (Exception e) {
map.put("success", false);
map.put("errMsg", e.getLocalizedMessage());
}
return map;
}
}
package com.zq.cas.credential; package com.zq.cas.credential;
import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apereo.cas.authentication.Credential;
import org.apereo.cas.authentication.UsernamePasswordCredential; import org.apereo.cas.authentication.UsernamePasswordCredential;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
...@@ -9,126 +10,40 @@ import javax.validation.constraints.Size; ...@@ -9,126 +10,40 @@ import javax.validation.constraints.Size;
* Created by Chen Tianzhong in 2021/6/20 * Created by Chen Tianzhong in 2021/6/20
* 重写UsernamePasswordCredential ,添加自己页面输入需要在后台获取到的字段 * 重写UsernamePasswordCredential ,添加自己页面输入需要在后台获取到的字段
*/ */
public class MyUsernamePasswordCredential extends UsernamePasswordCredential { public class MyUsernamePasswordCredential implements Credential {
// @Size(min = 1, message = "required.username") @Size(min = 1, message = "required.username")
// private String username; private String username;
// @Size(min = 1, message = "required.password") @Size(min = 1, message = "required.password")
// private String password; private String password;
//登录方式 //登录方式
@Size(min = 1, message = "require loginType") @Size(min = 1, message = "require loginType")
private String loginType; private String loginType;
//法师通 public String getUsername() {
@Size(min = 1, message = "require caType") return this.username;
private String caType;
@Size(min = 1, message = "require userSignedData")
private String userSignedData;
@Size(min = 1, message = "require userCert")
private String userCert;
@Size(min = 1, message = "require containerName")
private String containerName;
@Size(min = 1, message = "require random")
private String random;
@Size(min = 1, message = "require random")
private String caPwd;
// public String getUsername() {
// return this.username;
// }
//
// public String getPassword() {
// return this.password;
// }
//
// public void setUsername(final String username) {
// this.username = username;
// }
//
// public void setPassword(final String password) {
// this.password = password;
// }
public String getLoginType() {
return loginType;
}
public void setLoginType(String loginType) {
this.loginType = loginType;
}
public String getCaPwd() {
return caPwd;
}
public void setCaPwd(String caPwd) {
this.caPwd = caPwd;
} }
// public String getRememberUserName() { public String getPassword() {
// return rememberUserName; return this.password;
// }
//
// public void setRememberUserName(String rememberUserName) {
// this.rememberUserName = rememberUserName;
// }
public String getCaType() {
return caType;
}
public void setCaType(String caType) {
this.caType = caType;
}
public String getUserSignedData() {
return userSignedData;
}
public void setUserSignedData(String userSignedData) {
this.userSignedData = userSignedData;
}
public String getUserCert() {
return userCert;
} }
public void setUserCert(String userCert) { public void setUsername(final String username) {
this.userCert = userCert; this.username = username;
} }
public String getContainerName() { public void setPassword(final String password) {
return containerName; this.password = password;
} }
public void setContainerName(String containerName) { public String getLoginType() {
this.containerName = containerName; return loginType;
}
public String getRandom() {
return random;
} }
public void setRandom(String random) { public void setLoginType(String loginType) {
this.random = random; this.loginType = loginType;
} }
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// if (!super.equals(o)) return false;
// MyUsernamePasswordCredential that = (MyUsernamePasswordCredential) o;
// return loginType.equals(that.loginType) &&
// Objects.equals(rememberUserName, that.rememberUserName) &&
// Objects.equals(fstLogin, that.fstLogin);
// }
@Override @Override
public int hashCode() public int hashCode()
...@@ -136,12 +51,11 @@ private String loginType; ...@@ -136,12 +51,11 @@ private String loginType;
return new HashCodeBuilder() return new HashCodeBuilder()
.appendSuper(super.hashCode()) .appendSuper(super.hashCode())
.append(this.loginType) .append(this.loginType)
//.append(this.rememberUserName)
.append(this.caType)
.append(this.userSignedData)
.append(this.userCert)
.append(this.containerName)
.append(this.caPwd)
.toHashCode(); .toHashCode();
} }
@Override
public String getId() {
return this.username;
}
} }
package com.zq.cas.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
/**
* @author wilmiam
* @since 2021/12/25 16:12
*/
@Repository
public class CaUserDao {
@Autowired
private JdbcTemplate jdbcTemplate;
public String getCaUser(String caId) {
String sql = "SELECT YOUXIANG FROM ORG_CA_INFO WHERE CAID = ?";
String username = jdbcTemplate.queryForObject(sql, new String[]{caId}, new BeanPropertyRowMapper<>(String.class));
return username;
}
}
package com.zq.cas.dao;
import com.zq.cas.entity.*;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
/**
* Created by Chen Tianzhong in 2021/6/19
*/
@Repository("loginCountDao")
public class LoginCountDao {
@Resource
private JdbcTemplate jdbcTemplate;
/**
* 通过用户名查询用户角色信息
* @param
* @return
*/
public Map<String, Object> selectUserLoginCount(Integer userId, String countDate){
Map<String, Object> map = new HashMap<>();
String sql = "SELECT * FROM CAS_LOGIN_COUNT WHERE USERID=? AND COUNTDATE=? ";
List rows = jdbcTemplate.queryForList(sql,userId, countDate);
if(rows!=null && rows.size()>0){
map = (Map) rows.get(0);
}
// String sql = "SELECT * FROM CAS_LOGIN_COUNT WHERE USERID=? AND COUNTDATE=? ";
// return jdbcTemplate.queryForMap(sql, userId, countDate);
return map;
//LoginCount login = jdbcTemplate.queryForObject(sql, new Object[]{userId,countDate}, new BeanPropertyRowMapper<LoginCount>(LoginCount.class));
//return null;
}
public void updateUserLoginCount(String id, Integer count){
String sql = "UPDATE CAS_LOGIN_COUNT SET FREQUENCY = ? WHERE ID = ?";
jdbcTemplate.update(sql, count, id);
}
public void insertUserLoginCount(String id, SysUser user){
String sql = "INSERT INTO CAS_LOGIN_COUNT VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, id, user.getUSER_ID(), user.getNICK_NAME(),
user.getDEPT_ID(), user.getCOURT_CODE(), user.getORG_CODE(), 1, new Date());
}
}
package com.zq.cas.dao;
import com.zq.cas.entity.Login;
import com.zq.cas.entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
import java.util.Map;
/**
* Created by Chen Tianzhong in 2021/6/19
*/
@Repository("loginDao")
public class LoginDao {
@Resource
private JdbcTemplate jdbcTemplate;
/**
* 通过用户名查询用户角色信息
* @param userName
* @return
*/
public Login findByUserName(String userName){
String sql = "SELECT * FROM ORG_LOGIN WHERE YOUXIANG =?";
Login login = jdbcTemplate.queryForObject(sql, new String[]{userName}, new BeanPropertyRowMapper<Login>(Login.class));
return login;
}
}
package com.zq.cas.dao;
import com.zq.cas.entity.Login;
import com.zq.cas.entity.LoginDetail;
import com.zq.cas.entity.User;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import javax.annotation.Resource;
/**
* Created by Chen Tianzhong in 2021/6/19
*/
@Repository("loginDetailDao")
public class LoginDetailDao {
@Resource
private JdbcTemplate jdbcTemplate;
/**
* 通过用户名查询用户角色信息
* @param
* @return
*/
public void insertLoginDetail(LoginDetail loginDetail){
String sql = "INSERT INTO CAS_LOGIN_DETAIL VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
jdbcTemplate.update(sql, loginDetail.getID(), loginDetail.getUSERID(), loginDetail.getXM(),
loginDetail.getORGID(), loginDetail.getFY(), loginDetail.getJGBS(), loginDetail.getIP(),
loginDetail.getMAC(), loginDetail.getLOGIN_TIME());
}
}
package com.zq.cas.dao;
import com.zq.cas.entity.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
/**
* @author: chentianzhong
* @date: 2021/6/18
* @description: 操作用户信息
*/
@Repository("userDao")
public class UserDao {
@Autowired
private JdbcTemplate jdbcTemplate;
/**
* 通过用户名查询用户角色信息
*
* @param userName
* @return
*/
public SysUser findUserByUserName(String userName) {
String sql = "SELECT * FROM PUBLIC.SYS_USER WHERE ENABLED=1 AND USERNAME =?";
SysUser user = jdbcTemplate.queryForObject(sql, new String[]{userName}, new BeanPropertyRowMapper<SysUser>(SysUser.class));
return user;
}
public SysUser findUserByIdCard(String idCard) {
String sql = "SELECT * FROM PUBLIC.SYS_USER WHERE ENABLED=1 AND ID_CARD =?";
SysUser user = jdbcTemplate.queryForObject(sql, new String[]{idCard}, new BeanPropertyRowMapper<SysUser>(SysUser.class));
return user;
}
}
package com.zq.cas.entity;
import lombok.Data;
@Data
public class Login {
private Integer LOGINID;
private String YOUXIANG;
private String PASSWORD;
private Integer ISVALID;
private Integer RESETPWD;
private String LOGINTYPE;
}
package com.zq.cas.entity;
import lombok.Data;
import java.util.Date;
@Data
public class LoginCount {
private String ID;
private Integer USERID;
private String XM;
private Integer ORGID;
private String FY;
private Integer JGBS;
private Integer FREQUENCY;
private Date COUNTDATE;
}
package com.zq.cas.entity;
import lombok.Data;
import java.util.Date;
@Data
public class LoginDetail {
private String ID;
private Integer USERID;
private String XM;
private Integer ORGID;
private String FY;
private String JGBS;
private String IP;
private String MAC;
private Date LOGIN_TIME;
}
//package com.zq.cas.entity;
//
//import com.fasterxml.jackson.annotation.JsonIgnore;
//import com.fasterxml.jackson.annotation.JsonProperty;
//
//import javax.validation.constraints.NotNull;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * @author: wangsaichao
// * @date: 2018/8/9
// * @description: cas-rest返回cas服务端信息
// */
//public class RestSysUser {
//
// @JsonProperty("id")
// @NotNull
// private String username;
//
// /**
// * 需要返回实现org.apereo.cas.authentication.principal.Principal的类名接口
// */
// @JsonProperty("@class")
// private String clazz = "org.apereo.cas.authentication.principal.SimplePrincipal";
//
//
// @JsonProperty("attributes")
// private Map<String, Object> attributes = new HashMap<>();
//
// @JsonIgnore
// @NotNull
// private String password;
//
// /**
// * 用户状态,根据状态判断是否可用
// */
// @JsonIgnore
// private String state;
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getClazz() {
// return clazz;
// }
//
// public void setClazz(String clazz) {
// this.clazz = clazz;
// }
//
// public Map<String, Object> getAttributes() {
// return attributes;
// }
//
// public void setAttributes(Map<String, Object> attributes) {
// this.attributes = attributes;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public String getState() {
// return state;
// }
//
// public void setState(String state) {
// this.state = state;
// }
//
// @JsonIgnore
// public RestSysUser addAttribute(String key, Object val) {
// getAttributes().put(key, val);
// return this;
// }
//}
\ No newline at end of file
package com.zq.cas.entity; package com.zq.cas.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(schema = "PUBLIC",value = "SYS_USER")
public class SysUser { public class SysUser {
private Integer USER_ID; @TableId
private Long userId;
private Long deptId;
private Integer DEPT_ID; private String courtCode;
private String USERNAME; private String idCard;
private String NICK_NAME; private String username;
private String GENDER; private String nickName;
private String PHONE; private String email;
private String EMAIL; private String password;
private String PASSWORD; private String pCode;
private Integer IS_ADMIN; private String orgCode;
private String ID_CARD; private boolean isAdmin;
private String COURT_CODE; private Date pwdResetTime;
private String ORG_CODE; private Integer enabled;
private String P_CODE; private Integer isLinux;
private Integer IS_RECEIVER; private Integer isPwdChange;
private Long ENABLED; private Integer loginFailNum;
private Date loginLockTime;
private Integer loginType;
} }
package com.zq.cas.entity;
import lombok.Data;
import java.util.Date;
@Data
public class User {
private Integer USERID;
private Integer ORGID;
private String FY;
private Integer JGBS;
private Integer RYBS;
private String DLM;
private String PXH;
private String XM;
private Integer DLRBS;
private Integer XB;
private String CSRQ;
private String SFZHM;
private Integer MZ;
private Integer WHCD;
private Integer HYZK;
private Integer ZZMM;
private Integer XZJB;
private Integer ZW;
private String ZW_CODE;
private String FZZW_CODE;
private Integer ZC;
private Integer FGDJ;
private Integer FJDJ;
private Integer ZSBZ;
private Integer DHHM;
private String SJHM;
private String UNITPHONE;
private String YOUXIANG;
private String DYX;
private String XSZW;
private Integer SFRMPSY;
private Integer YX;
private String XTJS;
private String FGFW;
private String XTGN;
private String CJSJ;
private String GXSJ;
private Date ZXRQ;
private String SM;
private String QX;
private Integer LOGINTYPE;
private Integer BZ;
private Integer LEVEL;
private Integer SMS;
private String DOOR_PLATE;
private Date RDRQ;
private Date GZSJ;
}
package com.zq.cas.handler;
import org.apereo.cas.CentralAuthenticationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class LogInterceptor extends HandlerInterceptorAdapter {
@Autowired
private CentralAuthenticationService centralAuthenticationService;
/**
* 登录操作日志记录
*
* @param request
* @param response
* @param handler
* @param ex
*/
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
//判断是否为登录操作
if (request.getMethod().toLowerCase().equals("post") && request.getRequestURI().toLowerCase().contains("login")) {
}
}
}
package com.zq.cas.handler;
import com.zq.cas.entity.SysUser;
import com.zq.cas.service.ISysUserService;
import com.zq.cas.util.MD5PasswordEncoderUtil;
import org.apereo.cas.authentication.AuthenticationHandlerExecutionResult;
import org.apereo.cas.authentication.UsernamePasswordCredential;
import org.apereo.cas.authentication.handler.support.AbstractUsernamePasswordAuthenticationHandler;
import org.apereo.cas.authentication.principal.PrincipalFactory;
import org.apereo.cas.services.ServicesManager;
import javax.security.auth.login.AccountNotFoundException;
import java.security.GeneralSecurityException;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* 自定义登录验证器
*/
public class MyUsernameAndPasswordAuthenticationHandler extends AbstractUsernamePasswordAuthenticationHandler {
private ISysUserService sysUserService;
public MyUsernameAndPasswordAuthenticationHandler(String name, ServicesManager servicesManager, PrincipalFactory principalFactory, Integer order) {
super(name, servicesManager, principalFactory, order);
}
public ISysUserService getSysUserService() {
return sysUserService;
}
public void setSysUserService(ISysUserService sysUserService) {
this.sysUserService = sysUserService;
}
@Override
protected AuthenticationHandlerExecutionResult authenticateUsernamePasswordInternal(UsernamePasswordCredential credential, String originalPassword) throws GeneralSecurityException {
String username = credential.getUsername().trim();
String password = credential.getPassword().trim();
if (!username.contains("@gxfy.com")){
username += "@gxfy.com";
}
password = MD5PasswordEncoderUtil.encode(password);
SysUser user = sysUserService.findByUsernameAndPwd(username, password);
if (user == null){
throw new AccountNotFoundException("对象查询失败");
}
Map<String, Object> message = new LinkedHashMap<>();
message.put("userId", user.getUsername());
return createHandlerResult(credential,
this.principalFactory.createPrincipal(credential.getUsername(), message));
}
}
package com.zq.cas.handler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
*/
@Component
public class URLInterceptor implements HandlerInterceptor {
private static final Logger logger = LoggerFactory.getLogger(URLInterceptor.class);
@Override
public boolean preHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
String path = httpServletRequest.getServletPath();
logger.info(path);
System.out.println("__________________________________________________________________________");
System.out.println("Controller Name:"+((HandlerMethod)o).getBean().getClass().getName());
System.out.println("Controller Method Name:"+((HandlerMethod)o).getMethod().getName());
System.out.println("__________________________________________________________________________");
return true;
}
@Override
public void postHandle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
}
@Override
public void afterCompletion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
}
}
package com.zq.cas.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.cas.entity.SysUser;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysUserMapper extends BaseMapper<SysUser> {
}
package com.zq.cas.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zq.cas.entity.SysUser;
public interface ISysUserService extends IService<SysUser> {
SysUser findByUsername(String username);
SysUser findByUsernameAndPwd(String username, String password);
SysUser findByIdCard(String strCertEntityID);
}
package com.zq.cas.service;
import com.zq.cas.entity.SysUser;
import com.zq.cas.entity.User;
import java.util.Date;
import java.util.Map;
public interface LoginCountService {
public Map<String, Object> selectUserLoginCount(Integer userId, Date countDate);
public void updateUserLoginCount(String id, Integer count);
public void insertUserLoginCount(String id, SysUser user);
public void saveCasLoginCount(SysUser user);
}
package com.zq.cas.service;
import com.zq.cas.entity.LoginDetail;
import com.zq.cas.entity.SysUser;
public interface LoginDetailService {
public void insertLoginDetail(LoginDetail loginDetail);
public void saveLoginDetail(SysUser user);
}
package com.zq.cas.service;
import com.zq.cas.entity.Login;
import java.util.Map;
/**
* Created by Chen Tianzhong in 2021/6/19
*/
public interface LoginService {
public Login findByUserName(String userName);
}
package com.zq.cas.service;
import com.zq.cas.entity.SysUser;
/**
* @author: chentianzhong
* @date: 2021/6/18
* @description:
*/
public interface UserService {
public SysUser findUserByUserName(String userName);
public SysUser findUserByIdCard(String idCard);
}
package com.zq.cas.service.impl;
import com.zq.cas.dao.LoginCountDao;
import com.zq.cas.entity.SysUser;
import com.zq.cas.entity.User;
import com.zq.cas.service.LoginCountService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
import java.util.UUID;
@Service("loginCountService")
@Transactional
public class LoginCountServiceImpl implements LoginCountService {
@Resource
private LoginCountDao loginCountDao;
@Override
public Map<String, Object> selectUserLoginCount(Integer userId, Date countDate) {
if(countDate!=null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String currentDate = sdf.format(countDate);
return loginCountDao.selectUserLoginCount(userId, currentDate);
}
return null;
}
@Override
public void updateUserLoginCount(String id, Integer count) {
loginCountDao.updateUserLoginCount(id, count);
}
@Override
public void insertUserLoginCount(String id, SysUser user) {
loginCountDao.insertUserLoginCount(id, user);
}
@Override
public void saveCasLoginCount(SysUser user) {
Map<String, Object> map = selectUserLoginCount(user.getUSER_ID(), new Date());
if(map!=null && !map.isEmpty()){
Integer frequency = (Integer)map.get("FREQUENCY");
String id = (String)map.get("ID");
updateUserLoginCount(id, frequency+1);
}else{
String id = UUID.randomUUID().toString().replace("-","");
this.insertUserLoginCount(id, user);
}
}
}
package com.zq.cas.service.impl;
import com.zq.cas.dao.LoginDetailDao;
import com.zq.cas.entity.LoginDetail;
import com.zq.cas.entity.SysUser;
import com.zq.cas.service.LoginDetailService;
import com.zq.cas.util.HttpRequestUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Date;
import java.util.UUID;
@Service("loginDetailService")
public class LoginDetailServiceImpl implements LoginDetailService {
@Resource
private LoginDetailDao loginDetailDao;
@Transactional
@Override
public void insertLoginDetail(LoginDetail loginDetail) {
loginDetailDao.insertLoginDetail(loginDetail);
}
@Override
public void saveLoginDetail(SysUser user) {
if (user !=null){
LoginDetail detail = new LoginDetail();
String id = UUID.randomUUID().toString().replace("-","");
detail.setID(id);
detail.setUSERID(user.getUSER_ID());
detail.setXM(user.getNICK_NAME());
detail.setORGID(user.getDEPT_ID());
detail.setFY(user.getCOURT_CODE());
detail.setJGBS(user.getORG_CODE());
detail.setIP(HttpRequestUtils.getClientIp());
detail.setMAC("");
detail.setLOGIN_TIME(new Date());
this.insertLoginDetail(detail);
}
}
}
package com.zq.cas.service.impl;
import com.zq.cas.dao.LoginDao;
import com.zq.cas.entity.Login;
import com.zq.cas.service.LoginService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Map;
/**
* Created by Chen Tianzhong in 2021/6/19
*/
@Service("loginService")
public class LoginServiceImpl implements LoginService {
@Resource
private LoginDao loginDao;
@Override
public Login findByUserName(String userName) {
return loginDao.findByUserName(userName);
}
}
package com.zq.cas.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zq.cas.entity.SysUser;
import com.zq.cas.mapper.SysUserMapper;
import com.zq.cas.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
// private SysUserMapper sysUserMapper;
//
// @Autowired
// public void setSysUserMapper(SysUserMapper sysUserMapper) {
// this.sysUserMapper = sysUserMapper;
// }
@Override
public SysUser findByUsername(String username) {
if (StringUtils.isBlank(username)){
return null;
}
LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery(SysUser.class)
.eq(SysUser::getUsername, username)
.eq(SysUser::getEnabled, 1);
SysUser sysUser = null;
try{
sysUser = this.getOne(wrapper,false);
}catch (Exception e){
log.error("根据用户名查询对象失败,getIdCard:{}",username);
log.error(e.getLocalizedMessage(), e);
}
return sysUser;
}
@Override
public SysUser findByUsernameAndPwd(String username, String password) {
LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery(SysUser.class)
.eq(SysUser::getUsername, username)
.eq(SysUser::getPassword, password)
.eq(SysUser::getEnabled, 1);
SysUser sysUser = null;
try{
sysUser = this.getOne(wrapper);
}catch (Exception e){
log.error("根据用户名密码查询对象失败,username:{},password:{}",username, password);
log.error(e.getLocalizedMessage(), e);
}
return sysUser;
}
@Override
public SysUser findByIdCard(String strCertEntityID) {
if (StringUtils.isBlank(strCertEntityID)){
return null;
}
LambdaQueryWrapper<SysUser> wrapper = Wrappers.lambdaQuery(SysUser.class)
.eq(SysUser::getIdCard, strCertEntityID)
.eq(SysUser::getEnabled, 1)
.orderByDesc(SysUser::getUserId);
SysUser sysUser = null;
try{
sysUser = this.getOne(wrapper,false);
}catch (Exception e){
log.error("根据身份证查询对象失败,getIdCard:{}",strCertEntityID);
log.error(e.getLocalizedMessage(), e);
}
return sysUser;
}
}
package com.zq.cas.service.impl;
import com.zq.cas.dao.UserDao;
import com.zq.cas.entity.SysUser;
import com.zq.cas.service.UserService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author: chentianzhong
* @date: 2021/6/18
* @description:
*/
@Service("userService")
public class UserServiceImpl implements UserService {
@Resource
private UserDao userDao;
@Override
public SysUser findUserByUserName(String userName) {
return userDao.findUserByUserName(userName);
}
@Override
public SysUser findUserByIdCard(String idCard) {
return userDao.findUserByIdCard(idCard);
}
}
package com.zq.cas.vo;
import lombok.Data;
@Data
public class UserCertVo {
private String userCert;
private String strServerRan;
private String userSignedData;
private String loginType;
private String username;
private String password;
}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.zq.cas.config.SpringConfig,\ org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.zq.cas.config.SpringConfig,\
com.zq.cas.config.MyAuthenticationConfiguration,\ com.zq.cas.config.MyAuthenticationConfiguration,\
com.zq.cas.config.MyWebflowConfiguration,\ com.zq.cas.config.MyWebflowConfiguration,\
com.zq.cas.config.SpringConfig,\ com.zq.cas.config.SpringConfig
com.zq.cas.config.DataSourceConfig
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
# CAS Server Context Configuration # CAS Server Context Configuration
# #
server.context-path=/cas server.context-path=/cas
server.port=8443 server.port=8080
#修改不适用ssl #关闭ssl https
server.ssl.enabled=false server.ssl.enabled=false
#server.ssl.key-store=file:/Users/wangsaichao/Desktop/tomcat.keystore #server.ssl.key-store=file:/Users/wangsaichao/Desktop/tomcat.keystore
#server.ssl.key-store-password=changeit #server.ssl.key-store-password=changeit
...@@ -110,82 +110,42 @@ spring.aop.proxy-target-class=true ...@@ -110,82 +110,42 @@ spring.aop.proxy-target-class=true
#去掉https #去掉https
cas.tgc.secure=false cas.tgc.secure=false
#注册service中的json验证
cas.serviceRegistry.initFromJson=true cas.serviceRegistry.initFromJson=true
cas.serviceRegistry.watcherEnabled=true cas.serviceRegistry.watcherEnabled=true
cas.serviceRegistry.schedule.repeatInterval=120000 cas.serviceRegistry.schedule.repeatInterval=120000
cas.serviceRegistry.schedule.startDelay=15000 cas.serviceRegistry.schedule.startDelay=15000
cas.serviceRegistry.managementType=DEFAULT cas.serviceRegistry.managementType=DEFAULT
cas.serviceRegistry.json.location=classpath:/services cas.serviceRegistry.json.location=classpath:/services
##开启rest认证
#cas.authn.rest.uri=http://localhost:8080/cas/login
##如果密码有加密,打开下面配置,我的是明文
#cas.authn.rest.passwordEncoder.type=DEFAULT
#cas.authn.rest.passwordEncoder.characterEncoding=UTF-8
#cas.authn.rest.passwordEncoder.encodingAlgorithm=MD5
#退出 #退出
cas.logout.followServiceRedirects=true cas.logout.followServiceRedirects=true
cas.logout.redirectParameter=service cas.logout.redirectParameter=service
cas.logout.confirmLogout=false cas.logout.confirmLogout=false
cas.logout.removeDescendantTickets=true cas.logout.removeDescendantTickets=true
#数据库配置
#jdbc.ds.driverClassName=com.mysql.jdbc.Driver
#jdbc.ds.url=jdbc:mysql://127.0.0.1:3306/portal?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&useSSL=false
#jdbc.ds.username=root
#jdbc.ds.password=1qaz2wsx
jdbc.ds.driverClassName=com.kingbase8.Driver
jdbc.ds.url=jdbc:kingbase8://147.2.3.31:54321/GXFY_OA
#jdbc.ds.url=jdbc:kingbase8://171.106.48.55:36002/GXFY_OA
#jdbc.ds.url=jdbc:kingbase8://147.72.200.159:54321/GXFY_OA
jdbc.ds.username=GXfy_ZQ202101
jdbc.ds.password=GXfy/2014!@#$
#默认主题配置 #默认主题配置
cas.theme.defaultThemeName=app cas.theme.defaultThemeName=app
#自定义错误信息 #自定义错误信息
cas.authn.exceptions.exceptions=com.zq.cas.exception.LoginModeException,com.zq.cas.exception.PasswordErrorException,com.zq.cas.exception.NoLoginModeException cas.authn.exceptions.exceptions=com.zq.cas.exception.LoginModeException,com.zq.cas.exception.PasswordErrorException,com.zq.cas.exception.NoLoginModeException
#TGT的最大生存时间,28800秒,8小时
cas.ticket.tgt.maxTimeToLiveInSeconds=28800
#用户没有对系统进行任何操作的情况下,7200秒(2小时)之后TGT会过期
cas.ticket.tgt.timeToKillInSeconds=7200
## #ST可以用几次才过期
# CAS Authentication Credentials cas.ticket.st.numberOfUses=1
# #ST过期设置,默认是10秒
#cas.authn.accept.users=casuser::Mellon cas.ticket.st.timeToKillInSeconds=6000
#添加jdbc认证
#cas.authn.jdbc.query[0].sql=SELECT * FROM user_info WHERE username =?
#那一个字段作为密码字段
#cas.authn.jdbc.query[0].fieldPassword=password
#配置数据库连接
#cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/testshiro?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
#cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect
#数据库用户名
#cas.authn.jdbc.query[0].user=root
#数据库密码
#cas.authn.jdbc.query[0].password=123456
#mysql驱动
#cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
#配置加密策略
#cas.authn.jdbc.query[0].passwordEncoder.type=com.cas.CustomPasswordEncoder
#cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
#cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5
#加密迭代次数
#cas.authn.jdbc.encode[0].numberOfIterations=2
#该列名的值可替代上面的值,但对密码加密时必须取该值进行处理
#cas.authn.jdbc.encode[0].numberOfIterationsFieldName=
#盐值固定列
#cas.authn.jdbc.encode[0].saltFieldName=username
#静态盐值
#cas.authn.jdbc.encode[0].staticSalt=.
#cas.authn.jdbc.encode[0].sql=SELECT * FROM user_info WHERE username =?
#对处理盐值后的算法
#cas.authn.jdbc.encode[0].algorithmName=MD5
#cas.authn.jdbc.encode[0].passwordFieldName=password
#cas.authn.jdbc.encode[0].expiredFieldName=expired
#cas.authn.jdbc.encode[0].disabledFieldName=disabled
#数据库连接
#cas.authn.jdbc.encode[0].url=jdbc:mysql://127.0.0.1:3306/testshiro?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false
#cas.authn.jdbc.encode[0].dialect=org.hibernate.dialect.MySQL5Dialect
#cas.authn.jdbc.encode[0].driverClass=com.mysql.jdbc.Driver
#cas.authn.jdbc.encode[0].user=root
#cas.authn.jdbc.encode[0].password=123456
......
spring:
datasource:
driver-class-name: com.kingbase8.Driver
url: jdbc:kingbase8://172.18.3.137:54321/GXFY_OA
type: com.alibaba.druid.pool.DruidDataSource
username: SYSTEM
password: 123456
druid:
initial-size: 20
min-idle: 20
max-active: 200
max-wait: 5000
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
max-evictable-idle-time-millis: 900000
test-while-idle: true
test-on-borrow: false
test-on-return: false
validation-query: select 1
filters: stat
webStatFilter:
enabled: true
url-pattern: /*
exclusions: .js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*
stat-view-servlet:
enabled: true
allow: 127.0.0.1
url-pattern: /druid/*
reset-enable: false
login-username: gxxc
login-password: GXxc@123
filter:
stat:
enabled: true
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
enabled: false
mybatis-plus:
global-config:
db-config:
select-strategy: not_empty
update-strategy: not_empty
mapper-locations: classpath:/mapper/**/*.xml
ca:
svs:
root: C:/DSVSROOT
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<Configuration monitorInterval="5" > <Configuration monitorInterval="5" >
<!-- packages="org.zq.cas.logging" --> <!-- packages="org.zq.cas.logging" -->
<Properties> <Properties>
<Property name="baseDir">logs</Property> <Property name="baseDir">/usr/cas/logs</Property>
</Properties> </Properties>
<Appenders> <Appenders>
<Console name="console" target="SYSTEM_OUT"> <Console name="console" target="SYSTEM_OUT">
...@@ -225,6 +225,10 @@ ...@@ -225,6 +225,10 @@
<AsyncLogger name="com.cas.CustomPasswordEncoder" level="info" includeLocation="true"> <AsyncLogger name="com.cas.CustomPasswordEncoder" level="info" includeLocation="true">
<AppenderRef ref="casConsole"/> <AppenderRef ref="casConsole"/>
</AsyncLogger> </AsyncLogger>
<AsyncLogger name="com.zq.cas" level="info" includeLocation="true">
<AppenderRef ref="casFile"/>
<AppenderRef ref="casConsole"/>
</AsyncLogger>
<AsyncRoot level="error"> <AsyncRoot level="error">
<AppenderRef ref="casConsole"/> <AppenderRef ref="casConsole"/>
</AsyncRoot> </AsyncRoot>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zq.cas.mapper.SysUserMapper">
</mapper>
\ No newline at end of file
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* reset */
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, figcaption, figure, footer, header, hgroup, menu, nav, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; outline: 0; font-size: 100%; vertical-align: baseline; background: transparent; }
body { line-height: 1; }
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
nav ul { list-style: none; }
blockquote, q { quotes: none; }
blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; }
a { margin: 0; padding: 0; font-size: 100%; vertical-align: baseline; background: transparent; }
/* change colours to suit your needs */
ins { background-color: #ff9; color: #000; text-decoration: none; }
/* change colours to suit your needs */
mark { background-color: #ff9; color: #000; font-style: italic; font-weight: bold; }
del { text-decoration: line-through; }
abbr[title], dfn[title] { border-bottom: 1px dotted; cursor: help; }
table { border-collapse: collapse; border-spacing: 0; }
/* change border colour to suit your needs */
hr { display: block; height: 1px; border: 0; border-top: 1px solid #cccccc; margin: 1em 0; padding: 0; }
input, select { vertical-align: middle; }
/* general page */
body { font-family: Verdana, sans-serif; font-size: 11px; line-height: 1.4em; }
#cas { background: #eee; }
#cas .flc-screenNavigator-view-container { width: 95%; margin: 0 auto; }
#cas .flc-screenNavigator-view-container #header, #cas .flc-screenNavigator-view-container #content { background: #fff; -webkit-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.1); box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.1); }
#cas .flc-screenNavigator-view-container #content { -webkit-border-bottom-right-radius: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -moz-border-radius-bottomleft: 4px; border-bottom-right-radius: 4px; border-bottom-left-radius: 4px; }
@media only screen and (max-width: 960px) { #cas .flc-screenNavigator-view-container { width: 100%; }
#cas .flc-screenNavigator-view-container #content { -webkit-border-bottom-right-radius: 0px; -webkit-border-bottom-left-radius: 0px; -moz-border-radius-bottomright: 0px; -moz-border-radius-bottomleft: 0px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; } }
/* header */
#cas #header { padding-top: 10px; }
#cas #header #company-name { width: 118px; height: 31px; text-indent: -999em; background: url(../images/ja-sig-logo.gif) no-repeat; margin: 0 0 10px 10px; }
#cas #header #app-name { background: #210F7A; color: white; padding: 1.4em 1.4em; font-size: 2em; font-weight: normal; }
/* content */
#cas #content { padding: 10px; overflow: hidden; }
#cas #content #msg { padding: 20px; margin-bottom: 10px; }
#cas #content #msg h2 { font-size: 1.4em; margin-bottom: 0.5em; }
#cas #content #msg.errors { border: 1px dotted #BB0000; color: #BB0000; padding-left: 100px; background: url(../images/error.gif) no-repeat 20px center; }
#cas #content #msg.success { border: 1px dotted #390; color: #390; padding-left: 100px; background: url(../images/confirm.gif) no-repeat 20px center; }
#cas #content #msg.info { border: 1px dotted #008; color: #008; padding-left: 100px; background: url(../images/info.gif) no-repeat 20px center; }
#cas #content #login { width: 320px; float: left; margin-right: 20px; }
#cas #content #login #fm1 { padding: 20px; background: #eee; -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; }
#cas #content #login #fm1 h2 { font-size: 1.4em; font-weight: normal; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #DDDDDD; }
#cas #content #login #fm1 .row { margin-bottom: 10px; }
#cas #content #login #fm1 .row .fl-label { display: block; color: #777777; }
#cas #content #login #fm1 .row input[type=text], #cas #content #login #fm1 .row input[type=password] { padding: 6px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; border: 1px solid #DDDDDD; background: #FFFFDD; }
#cas #content #login #fm1 .row.check { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid #DDDDDD; color: #777; font-size: 11px; }
#cas #content #login #fm1 .row .btn-submit { border-width: 2px; padding: 3px; margin-right: 4px; }
#cas #content #login #fm1 .row .btn-reset { border: 0; background: none; color: #777; text-transform: lowercase; border-left: 1px solid #ddd; }
#cas #content #login #fm1 .row .btn-submit:hover, #cas #content #login #fm1 .row .btn-reset:hover { cursor: pointer; }
#cas #content #sidebar { width: auto; }
#cas #content #sidebar .sidebar-content { padding-left: 20px; }
#cas #content #sidebar .sidebar-content p { margin-bottom: 1.4em; }
#cas #content #sidebar .sidebar-content #list-languages ul { list-style: none; }
#cas #content #sidebar .sidebar-content #list-languages ul li { display: inline-block; padding: 0px 10px; border-right: 1px solid #e2e2e2; }
#cas #content #sidebar .sidebar-content #list-languages ul li:last-child { border: 0; line-height: 1.4em; }
/* footer */
#cas #footer { color: #999; margin: 20px 0; }
/* < 960 */
@media only screen and (max-width: 960px) { #cas #footer { padding-left: 10px; } }
/* < 799 */
@media only screen and (max-width: 799px) { #cas #header #app-name { font-size: 1em; }
#cas #content #login { float: none; width: 100%; }
#cas #content #login #fm1 .row .fl-label { margin-left: -10px; }
#cas #content #login #fm1 .row input[type=text], #cas #content #login #fm1 .row input[type=password] { width: 100%; margin-left: -10px; padding: 10px; }
#cas #content #login #fm1 .row .btn-submit { outline: none; -webkit-appearance: none; -webkit-border-radius: 0; border: 0; background: #210F7A; color: white; font-weight: bold; width: 100%; padding: 10px 20px; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }
#cas #content #login #fm1 .row .btn-reset { display: none; }
#cas #content #sidebar { margin-top: 20px; }
#cas #content #sidebar .sidebar-content { padding: 0; } }
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/***************************************/
/* general styles */
html {
background: -webkit-gradient(linear, left top, right top,
from(#c5ccd3),
to(#cfd5dd),
color-stop(0.80, #c5ccd3),
color-stop(0.80, #cfd5dd));
}
.fl-theme-uportal .fl-bevel-black {
text-shadow: rgba(0,0,0,0.35) 0px -1px 0px;
}
.fl-theme-uportal .fl-bevel-white {
text-shadow: rgba(255,255,255,1) 0px 1px 0px;
}
.fl-theme-uportal a {
-webkit-touch-callout:none; /* prevents iphone popup menu to copy / follow / bookmark a particular link */
-webkit-tap-highlight-color: rgba(0,0,0,0);
text-decoration:none;
color:#000;
}
/***************************************/
/* Navigation Bar */
body::before {
border-top-color:#ccd6e2;
border-bottom-color:#000;
background-image: -webkit-gradient(linear, left top, left bottom,
from(#B0BCCD),
color-stop(0.5, #889BB3),
color-stop(0.50, #6D84A2),
to(#6D84A2)
);
}
.fl-theme-uportal .fl-navbar {
color:#fff;
text-shadow: rgba(0,0,0,0.5) 0px -1px 0px;
}
.fl-theme-uportal .fl-navbar h1 {
color:#fff;
}
.fl-theme-uportal .fl-navbar a {
color: #fff;
}
.fl-theme-uportal .fl-navbar [class*=fl-button] {
background-image: -webkit-gradient(linear, left top, left bottom,
from(#9aafca),
color-stop(0.5, #6d8cb3),
color-stop(0.50, #4b6b90),
to(#4b6b90)
);
-webkit-border-image:none;
}
.fl-theme-uportal .fl-navbar [class*=fl-button]:active {
background-image: -webkit-gradient(linear, left top, left bottom,
from(rgba(149, 184, 239,1)),
to(rgba(35,109,229,1)),
color-stop(0.5, rgba(149, 184, 239,1)),
color-stop(0.50, rgba(75,148,244,1))
);
}
.fl-theme-uportal .fl-navbar .fl-backButton {
/* See mobile layout for details */
-webkit-border-image: url(images/iphone/navbar_back_button_insetShadow.png) 0 15 stretch;
-webkit-mask-box-image: url(images/iphone/backbutton_mask.png) 0 15 stretch;
}
.fl-theme-uportal .fl-navbar .fl-button-inner {
-webkit-border-image: url(images/iphone/navbar_normal_button_insetShadow.png) 5 5 5 5 stretch;
}
/***************************************/
/* iPhone general purpose gel buttons */
/* effect is applied anywhere but the navbar, which has its own button look */
.fl-theme-uportal .fl-button {
text-decoration:none;
font-weight:bold;
-webkit-border-image: url(images/iphone/button_bg_insetShadow.png) 10 stretch;
}
.fl-theme-uportal .fl-button.fl-bevel-white {
color:#333333;
}
.fl-theme-uportal .fl-button.fl-bevel-black {
color:#FFFFFF;
}
.fl-theme-uportal .fl-button-white {
background-image: -webkit-gradient(linear, left top, left bottom,
from(rgba(240,240,240,0.25)),
to(rgba(220,220,220,0.75)),
color-stop(0.5, rgba(240,240,240,1)),
color-stop(0.50, rgba(200,200,200,0.8))
);
}
.fl-theme-uportal .fl-button-black {
background-image: -webkit-gradient(linear, left top, left bottom,
from(rgba(106,106,106,0.25)),
to(rgba(00,00,00,0.75)),
color-stop(0.5, rgba(130,130,130,1)),
color-stop(0.50, rgba(75,75,75,0.8))
);
}
.fl-theme-uportal .fl-button-green {
background-image: -webkit-gradient(linear, left top, left bottom,
from(rgba(120,190,130,0.2)),
to(rgba(50,170,60,0.75)),
color-stop(0.5, rgba(120,190,130,1)),
color-stop(0.50, rgba(0,150,10,0.8))
);
}
.fl-theme-uportal .fl-button-blue {
background-image: -webkit-gradient(linear, left top, left bottom,
from(rgba(149, 184, 239,0.2)),
to(rgba(35,109,229,0.75)),
color-stop(0.5, rgba(149, 184, 239,1)),
color-stop(0.50, rgba(75,148,244,0.8))
);
}
/***************************************/
/* iPhone tabs 1: small general purpose content dividers */
.fl-theme-uportal .fl-tabs li {
background-image: -webkit-gradient(linear, left top, left bottom,
from(#9aafca),
color-stop(0.5, #6d8cb3),
color-stop(0.50, #4b6b90),
to(#4b6b90)
);
-webkit-border-image: url(images/iphone/navbar_normal_button_insetShadow.png) 5 5 5 5 stretch;
-webkit-border-left-image: none;
-webkit-background-origin: border;
-webkit-background-clip: border;
}
.fl-theme-uportal .fl-tabs .fl-tabs-active {
background-image: -webkit-gradient(linear, left top, left bottom,
from(rgba(149, 184, 239,1)),
to(rgba(35,109,229,1)),
color-stop(0.5, rgba(149, 184, 239,1)),
color-stop(0.50, rgba(75,148,244,1))
);
}
.fl-theme-uportal .fl-tabs li a,
.fl-theme-uportal .fl-tabs .fl-tabs-active a {
color:#fff;
border-right-color:rgba(255,255,255,0.35);
border-left-color:rgba(0,0,0,0.35);
}
/*************************************************/
/* iPhone list menu styles: Ordered lists, Unordererd lists, Thumbnail lists, Icon lists, Definition lists */
/*************************************************/
/* Default list system setup */
.fl-theme-uportal .fl-listmenu li a {
-webkit-tap-highlight-color: -webkit-gradient(linear, left top, left bottom, from(#4a94f4), to(#236de5));
background:#fff url(images/iphone/listmenu_arrow.png) no-repeat right 5px;
}
.fl-theme-uportal [class*=fl-list] > li {
color: #000;
border-color: rgb(169,173,176);
background-color:#fff;
}
/* A simulation for a:active on the device, requires JS */
.fl-theme-uportal [class*=fl-list]:not(.fl-list) a:active,
.fl-theme-uportal [class*=fl-list] .fl-link-hilight {
color: #fff;
background: url(images/iphone/listmenu_arrow.png) no-repeat right -25px,
-webkit-gradient(linear, left top, left bottom, from(#4a94f4), to(#236de5));
}
.fl-theme-uportal [class*=fl-list] .fl-link-loading {
color: #fff !important;
background: url(images/iphone/listmenu_loader.gif) no-repeat 97% center,
-webkit-gradient(linear, left top, left bottom, from(#4a94f4), to(#236de5));
}
.fl-theme-uportal [class*=fl-list]:not(.fl-list) a:active,
.fl-theme-uportal [class*=fl-list] a:active .fl-link-secondary,
.fl-theme-uportal [class*=fl-list] a:active .fl-link-summary,
.fl-theme-uportal [class*=fl-list] .fl-link-loading * {
color: #fff !important;
}
/* secondary link info behaviour */
.fl-theme-uportal [class*=fl-list] > li .fl-link-secondary {
color: rgb(50, 79, 133);
}
/* summary link info ehaviour */
.fl-theme-uportal [class*=fl-list] > li .fl-link-summary {
color:#999;
}
.fl-theme-uportal .fl-list a {
color:#4a94f4;
}
/***************************************/
/* instructional text (usually embossed too)*/
.fl-theme-uportal .fl-note {
color:#4C566C;
}
/****************************/
/* Collapsing and expanding panels */
.fl-theme-uportal .fl-panel-autoHeading > *:first-child {
color:#fff;
background: -webkit-gradient(linear, left top, left bottom, from(#999), to(#000));
}
.fl-theme-uportal .fl-panel-autoHeading > *:first-child:focus {
color:#000;
background: -webkit-gradient(linear, left top, left bottom, from(#FFF), to(#CCC));
}
/****************************/
/* Gloss tint for glossy icons/thumbnails */
.fl-theme-uportal .fl-list-glossy > li a::before {
background-image: -webkit-gradient(radial, 50% -15%, 10, 50% -50%, 45, from(rgba(255,255,255,1)), to(rgba(255,255,255,0)), color-stop(90%, rgba(255,255,255,.65)));
}
/*
------------------------------------
Overrides to jqueryui css.
------------------------------------
*/
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button,
.ui-widget {font-size: 1em; font-family:arial,helvetica,clean,sans-serif;}
.ui-tabs .ui-tabs-nav li a {
font-size: 0.8em;
padding:0.2em 0.5em;
}
.ui-tabs .ui-tabs-nav {
padding:0.2em 0.1em 0;
}
/* jQuery tooltip */
#tooltip {background-color: #fffbbf; color: #344461; border: thin solid #b1c6f2;}
/*
*/
#portalWelcome { text-align: right; padding-right: 10px; }
.portlet-content-container { background-color: #fff; padding: 5px; margin: 5px; }
/* Fluid pager component styles */
.fl-theme-uportal .fl-pager ul.fl-pager-ui {text-align:right}
.fl-theme-uportal .fl-pager .fl-pager-ui li {list-style-type:none; display:inline; padding-left:5px}
.fl-theme-uportal .fl-pager .fl-pager-ui a.fl-pager-disabled,
.fl-theme-uportal .fl-pager .fl-pager-ui .fl-pager-disabled a { color: #777777; border: 0; text-decoration: none; cursor: default; }
.fl-theme-uportal .fl-pager .fl-pager-ui a.fl-pager-currentPage,
.fl-theme-uportal .fl-pager .fl-pager-ui .fl-pager-currentPage a { color: #000000; border: 0; text-decoration: none; cursor: default;}
.fl-theme-uportal a { color:#4b6b90; }
.up-mobile-navigation-container a { color:#000; }
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#header, #content, #footer, .clearfix, #student .row, #student .col {zoom:1;} /* needs to be seen by IE7 to trigger hasLayout */
/* FOOTER --------------------------------- */
#footer {padding-bottom:1em;}
/* lt IE6 */
* html #cas #login .btn-submit {background:#ffd;}
* html #cas #login .btn-row {top:5px;}
* html #sidebar {display:inline;} /* double margin on float bug */
* html input.btn-submit {padding:2px .25em; width:0; overflow:visible;} /* extra width fix */
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/* IE Pick-a-boo bug fix */
form {height: expression('1%');}
/* Fixes Display: Block issue in IE5.5 and 6x */
div,
form,
fieldset,
#navlist li a,
td a {height:1px;}
/* Fixes IE problem with fieldset+legend boundaries */
fieldset {position: expression('relative');}
legend {
position: expression('absolute');
top: expression('-9px'); /* Fixes IE problem with fieldset+legend boundaries */
}
/* double float margin bug */
form,
#navcontainer {display:inline;}
/* button width fix */
button {
overflow:visible;
width:1px;
padding-left:0.5em;
padding-right:0.5em;
font-size:1.1em;
}
/* miscellaneous */
input {margin-left:0;}
ol li {line-height:1.0;}
input.check {width:13px; height:13px;}
span a {display:inline-block;}
label.top {margin-left:0;}
label.ieFix {margin-top:.5em;}
fieldset fieldset {padding-bottom:0;}
\ No newline at end of file
/*
* Licensed to Jasig under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Jasig licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a
* copy of the License at the following location:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
.fl-reorderer-instructions{
background-color:#F5FFB0;
border:1px solid #FFE390;
margin:5px;
padding:10px;
}
.fl-reorderer-instructions strong{
display:block;
}
.fl-reorderer-movable-default{
cursor:move;
}
.fl-reorderer-movable-selected{
background-color:yellow;
}
.fl-reorderer-movable-hover{
background-color:yellow;
}
.fl-reorderer-movable-dragging{
background:#ccc;
}
.fl-reorderer-avatar {
cursor:move;
list-style-type:none;
filter:alpha(opacity=75);
opacity:.75;
}
.fl-reorderer-dropWarning{
display:none;
padding:5px 25px;
color:#fff;opacity:1;
filter:alpha(opacity=100);
background:#900 url('../../images/services/error.gif')
no-repeat 5px center;
}
.fl-reorderer-verticalLayout .fl-reorderer-dropMarker,.fluid-vertical-order .fl-reorderer-dropMarker{
background-color:#F00;
height:0;
padding:2px 0 0 0;
border-width:0;
margin:-2px 0 0 0;
list-style-type:none;
font-size:0;
line-height:0;
overflow:hidden;
}
.fl-reorderer-horizontalLayout .fl-reorderer-dropMarker,.fluid-horizontal-order .fl-reorderer-dropMarker{
background-color:#F00;
padding:0 3px;
border-width:0;
margin:0 -3px!important;
list-style-type:none;
overflow:hidden;
width:0!important;
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment