├── .idea ├── dictionaries │ └── Administrator.xml ├── encodings.xml ├── modules.xml ├── misc.xml ├── libraries │ ├── Maven__ognl_ognl_3_0_8.xml │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__org_ow2_asm_asm_5_0_3.xml │ ├── Maven__org_yaml_snakeyaml_1_17.xml │ ├── Maven__redis_clients_jedis_2_9_0.xml │ ├── Maven__org_mybatis_mybatis_3_4_5.xml │ ├── Maven__xml_apis_xml_apis_1_4_01.xml │ ├── Maven__xerces_xercesImpl_2_11_0.xml │ ├── Maven__org_objenesis_objenesis_2_1.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_25.xml │ ├── Maven__com_fasterxml_classmate_1_3_4.xml │ ├── Maven__net_minidev_json_smart_2_2_1.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__commons_codec_commons_codec_1_8.xml │ ├── Maven__org_apache_shiro_shiro_web_1_4_0.xml │ ├── Maven__org_assertj_assertj_core_2_6_0.xml │ ├── Maven__org_codehaus_groovy_groovy_2_4_12.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_25.xml │ ├── Maven__org_skyscreamer_jsonassert_1_4_0.xml │ ├── Maven__net_minidev_accessors_smart_1_1.xml │ ├── Maven__org_apache_shiro_shiro_core_1_4_0.xml │ ├── Maven__org_apache_shiro_shiro_lang_1_4_0.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_2_0.xml │ ├── Maven__org_apache_shiro_shiro_cache_1_4_0.xml │ ├── Maven__org_apache_shiro_shiro_event_1_4_0.xml │ ├── Maven__org_mockito_mockito_core_1_10_19.xml │ ├── Maven__org_mybatis_mybatis_spring_1_3_1.xml │ ├── Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml │ ├── Maven__org_hamcrest_hamcrest_library_1_3.xml │ ├── Maven__org_javassist_javassist_3_21_0_GA.xml │ ├── Maven__ch_qos_logback_logback_core_1_1_11.xml │ ├── Maven__org_apache_shiro_shiro_spring_1_4_0.xml │ ├── Maven__org_apache_tomcat_tomcat_jdbc_8_5_23.xml │ ├── Maven__org_apache_tomcat_tomcat_juli_8_5_23.xml │ ├── Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml │ ├── Maven__mysql_mysql_connector_java_5_1_44.xml │ ├── Maven__net_sourceforge_nekohtml_nekohtml_1_9_22.xml │ ├── Maven__ch_qos_logback_logback_classic_1_1_11.xml │ ├── Maven__org_apache_commons_commons_pool2_2_4_2.xml │ ├── Maven__org_thymeleaf_thymeleaf_2_1_5_RELEASE.xml │ ├── Maven__org_unbescape_unbescape_1_1_0_RELEASE.xml │ ├── Maven__org_apache_shiro_shiro_config_core_1_4_0.xml │ ├── Maven__org_apache_shiro_shiro_config_ogdl_1_4_0.xml │ ├── Maven__org_apache_shiro_shiro_crypto_core_1_4_0.xml │ ├── Maven__org_apache_shiro_shiro_crypto_hash_1_4_0.xml │ ├── Maven__commons_beanutils_commons_beanutils_1_9_3.xml │ ├── Maven__org_apache_shiro_shiro_crypto_cipher_1_4_0.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_core_2_8_10.xml │ ├── Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml │ ├── Maven__javax_validation_validation_api_1_1_0_Final.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_23.xml │ ├── Maven__org_springframework_spring_tx_4_3_12_RELEASE.xml │ ├── Maven__commons_collections_commons_collections_3_2_2.xml │ ├── Maven__org_springframework_spring_aop_4_3_12_RELEASE.xml │ ├── Maven__org_springframework_spring_oxm_4_3_12_RELEASE.xml │ ├── Maven__org_springframework_spring_web_4_3_12_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_3_12_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_4_3_12_RELEASE.xml │ ├── Maven__org_springframework_spring_test_4_3_12_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_23.xml │ ├── Maven__org_springframework_spring_beans_4_3_12_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_databind_2_8_10.xml │ ├── Maven__org_hibernate_hibernate_validator_5_3_5_Final.xml │ ├── Maven__org_thymeleaf_thymeleaf_spring4_2_1_5_RELEASE.xml │ ├── Maven__org_apache_tomcat_tomcat_annotations_api_8_5_23.xml │ ├── Maven__org_springframework_boot_spring_boot_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_spring_webmvc_4_3_12_RELEASE.xml │ ├── Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml │ ├── Maven__org_springframework_spring_context_4_3_12_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_23.xml │ ├── Maven__org_springframework_spring_expression_4_3_12_RELEASE.xml │ ├── Maven__nz_net_ultraq_thymeleaf_thymeleaf_layout_dialect_1_4_0.xml │ ├── Maven__org_springframework_boot_spring_boot_test_1_5_8_RELEASE.xml │ ├── Maven__com_github_theborakompanioni_thymeleaf_extras_shiro_1_2_1.xml │ ├── Maven__org_springframework_data_spring_data_redis_1_8_8_RELEASE.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_3_1.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_spring_context_support_4_3_12_RELEASE.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__org_springframework_data_spring_data_commons_1_13_8_RELEASE.xml │ ├── Maven__org_springframework_data_spring_data_keyvalue_1_2_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_web_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_test_1_5_8_RELEASE.xml │ ├── Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_3_1.xml │ ├── Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_logging_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_thymeleaf_1_5_8_RELEASE.xml │ ├── Maven__org_springframework_boot_spring_boot_starter_data_redis_1_5_8_RELEASE.xml │ └── Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_8_RELEASE.xml ├── compiler.xml ├── inspectionProfiles │ └── Project_Default.xml ├── uiDesigner.xml └── shirodemo.iml ├── target └── classes │ ├── com │ └── test │ │ └── shiro │ │ ├── entity │ │ ├── Role.class │ │ ├── User.class │ │ ├── Permission.class │ │ ├── UserRole.class │ │ └── RolePermission.class │ │ ├── util │ │ └── MD5Utils.class │ │ ├── constant │ │ └── Constant.class │ │ ├── mapper │ │ ├── RoleMapper.class │ │ ├── UserMapper.class │ │ └── PermissionMapper.class │ │ ├── redis │ │ ├── RedisCache.class │ │ └── RedisUtils.class │ │ ├── config │ │ └── ShiroConfig.class │ │ ├── service │ │ ├── RoleService.class │ │ ├── UserService.class │ │ ├── TokenService.class │ │ ├── PermissionService.class │ │ └── impl │ │ │ ├── RoleServiceImpl.class │ │ │ ├── TokenServiceImpl.class │ │ │ ├── UserServiceImpl.class │ │ │ └── PermissionServiceImpl.class │ │ ├── shiro │ │ ├── MyShiroRealm.class │ │ ├── MyShiroRealm2.class │ │ ├── CustomizedToken.class │ │ ├── MyUsernamePasswordToken.class │ │ └── CustomizedModularRealmAuthenticator.class │ │ ├── ShiroDemoApplication.class │ │ ├── controller │ │ ├── HomeController.class │ │ ├── UserController.class │ │ ├── SimpleErrorController.class │ │ └── DefaultExceptionHandler.class │ │ └── filter │ │ ├── MyAccessControlFilter.class │ │ └── MyFormAuthenticationFilter.class │ ├── mapper │ ├── UserMapper.xml │ └── PermissionMapper.xml │ └── application.properties ├── src └── main │ ├── java │ └── com │ │ └── test │ │ └── shiro │ │ ├── constant │ │ └── Constant.java │ │ ├── service │ │ ├── RoleService.java │ │ ├── TokenService.java │ │ ├── UserService.java │ │ ├── PermissionService.java │ │ └── impl │ │ │ ├── RoleServiceImpl.java │ │ │ ├── TokenServiceImpl.java │ │ │ ├── UserServiceImpl.java │ │ │ └── PermissionServiceImpl.java │ │ ├── mapper │ │ ├── RoleMapper.java │ │ ├── UserMapper.java │ │ └── PermissionMapper.java │ │ ├── ShiroDemoApplication.java │ │ ├── entity │ │ ├── UserRole.java │ │ ├── Role.java │ │ ├── RolePermission.java │ │ ├── Permission.java │ │ └── User.java │ │ ├── util │ │ └── MD5Utils.java │ │ ├── controller │ │ ├── DefaultExceptionHandler.java │ │ ├── UserController.java │ │ ├── SimpleErrorController.java │ │ └── HomeController.java │ │ ├── filter │ │ ├── MyFormAuthenticationFilter.java │ │ └── MyAccessControlFilter.java │ │ ├── shiro │ │ ├── MyUsernamePasswordToken.java │ │ ├── MyModularRealmAuthenticator.java │ │ ├── MyShiroRealm2.java │ │ ├── MyShiroRealm.java │ │ └── ShiroService.java │ │ ├── redis │ │ ├── RedisCache.java │ │ └── RedisUtils.java │ │ └── config │ │ └── ShiroConfig.java │ └── resources │ ├── mapper │ ├── UserMapper.xml │ └── PermissionMapper.xml │ └── application.properties └── pom.xml /.idea/dictionaries/Administrator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /target/classes/com/test/shiro/entity/Role.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/entity/Role.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/entity/User.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/entity/User.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/util/MD5Utils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/util/MD5Utils.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/constant/Constant.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/constant/Constant.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/entity/Permission.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/entity/Permission.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/entity/UserRole.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/entity/UserRole.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/mapper/RoleMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/mapper/RoleMapper.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/mapper/UserMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/mapper/UserMapper.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/redis/RedisCache.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/redis/RedisCache.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/redis/RedisUtils.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/redis/RedisUtils.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/config/ShiroConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/config/ShiroConfig.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/RoleService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/RoleService.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/UserService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/UserService.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/shiro/MyShiroRealm.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/shiro/MyShiroRealm.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/shiro/MyShiroRealm2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/shiro/MyShiroRealm2.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/ShiroDemoApplication.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/ShiroDemoApplication.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/entity/RolePermission.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/entity/RolePermission.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/TokenService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/TokenService.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/shiro/CustomizedToken.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/shiro/CustomizedToken.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/mapper/PermissionMapper.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/mapper/PermissionMapper.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/controller/HomeController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/controller/HomeController.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/controller/UserController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/controller/UserController.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/PermissionService.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/PermissionService.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/filter/MyAccessControlFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/filter/MyAccessControlFilter.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/impl/RoleServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/impl/RoleServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/impl/TokenServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/impl/TokenServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/impl/UserServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/impl/UserServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/shiro/MyUsernamePasswordToken.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/shiro/MyUsernamePasswordToken.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/controller/SimpleErrorController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/controller/SimpleErrorController.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/controller/DefaultExceptionHandler.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/controller/DefaultExceptionHandler.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/filter/MyFormAuthenticationFilter.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/filter/MyFormAuthenticationFilter.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/service/impl/PermissionServiceImpl.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/service/impl/PermissionServiceImpl.class -------------------------------------------------------------------------------- /target/classes/com/test/shiro/shiro/CustomizedModularRealmAuthenticator.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rhettpang/Springboot-Shiro/HEAD/target/classes/com/test/shiro/shiro/CustomizedModularRealmAuthenticator.class -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/constant/Constant.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.constant; 2 | 3 | /** 4 | * @author Created by pangkunkun on 2017/11/20. 5 | */ 6 | public class Constant { 7 | 8 | public static final String CRS_KEY="crsKey"; 9 | public static final String SIGNATURE="signature"; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/RoleService.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service; 2 | 3 | import com.test.shiro.entity.Role; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/16. 7 | */ 8 | public interface RoleService { 9 | 10 | /** 11 | * 新增角色 12 | * @param role 13 | * */ 14 | void save(Role role); 15 | } 16 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/TokenService.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service; 2 | 3 | import org.apache.shiro.authc.UsernamePasswordToken; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/19. 7 | */ 8 | public interface TokenService { 9 | 10 | /** 11 | * 使用header中token的字符串查找redis中存储的相关信息 12 | * @param token 13 | * @return UsernamePasswordToken 14 | * */ 15 | UsernamePasswordToken findByToken(String token); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/mapper/RoleMapper.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.mapper; 2 | 3 | import com.test.shiro.entity.Role; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @author Created by pangkunkun on 2017/11/20. 9 | */ 10 | @Mapper 11 | @Service 12 | public interface RoleMapper { 13 | 14 | /** 15 | * 新增角色 16 | * @param role 17 | * */ 18 | void save(Role role); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service; 2 | 3 | import com.test.shiro.entity.User; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/16. 7 | */ 8 | public interface UserService { 9 | 10 | /** 11 | * 通过userName获取用户信息 12 | * @param username 13 | * @return User 14 | * */ 15 | User findByUsername(String username); 16 | 17 | /** 18 | * 新增user 19 | * @param user 20 | * */ 21 | void save(User user); 22 | } 23 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ognl_ognl_3_0_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_ow2_asm_asm_5_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_yaml_snakeyaml_1_17.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__redis_clients_jedis_2_9_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_4_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__xml_apis_xml_apis_1_4_01.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__xerces_xercesImpl_2_11_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/ShiroDemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro; 2 | 3 | import org.mybatis.spring.annotation.MapperScan; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | /** 8 | * @author Created by pangkunkun on 2017/11/15. 9 | */ 10 | @SpringBootApplication 11 | @MapperScan(basePackages = "com.test.shiro.mapper") 12 | public class ShiroDemoApplication{ 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(ShiroDemoApplication.class,args); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_classmate_1_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_json_smart_2_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/PermissionService.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service; 2 | 3 | import com.test.shiro.entity.Permission; 4 | import java.util.List; 5 | 6 | /** 7 | * @author Created by pangkunkun on 2017/11/16. 8 | */ 9 | public interface PermissionService { 10 | 11 | 12 | /** 13 | * 新增角色 14 | * @param permission 15 | * */ 16 | void save(Permission permission); 17 | 18 | /** 19 | * 通过userId获取用户所具有的权限 20 | * @param userId 21 | * @return List 22 | * */ 23 | List findPermissionAndRoleNameByUserId(String userId); 24 | } 25 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_8.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_web_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_assertj_assertj_core_2_6_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_codehaus_groovy_groovy_2_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_skyscreamer_jsonassert_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_accessors_smart_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_core_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_lang_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.mapper; 2 | 3 | import com.test.shiro.entity.User; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @author Created by pangkunkun on 2017/11/20. 9 | */ 10 | @Mapper 11 | @Service 12 | public interface UserMapper { 13 | 14 | /** 15 | * 通过username获取用户信息 16 | * @param username 17 | * @return User 18 | * */ 19 | User findByUsername(String username); 20 | 21 | /** 22 | * 新增user 23 | * @param user 24 | * */ 25 | void save(User user); 26 | } 27 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_cache_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_event_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mockito_mockito_core_1_10_19.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_1_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_library_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_javassist_javassist_3_21_0_GA.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_core_1_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_spring_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_tomcat_jdbc_8_5_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_tomcat_juli_8_5_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_log4j_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_5_1_44.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_sourceforge_nekohtml_nekohtml_1_9_22.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_classic_1_1_11.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_pool2_2_4_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_thymeleaf_2_1_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_unbescape_unbescape_1_1_0_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_config_core_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_config_ogdl_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_crypto_core_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_crypto_hash_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_beanutils_commons_beanutils_1_9_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_shiro_shiro_crypto_cipher_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_core_2_8_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jboss_logging_jboss_logging_3_3_1_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_validation_validation_api_1_1_0_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_8_5_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_collections_commons_collections_3_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_oxm_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_8_5_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_databind_2_8_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hibernate_hibernate_validator_5_3_5_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_thymeleaf_thymeleaf_spring4_2_1_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_tomcat_annotations_api_8_5_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/entity/UserRole.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/16. 7 | */ 8 | public class UserRole implements Serializable{ 9 | 10 | private static final long serialVersionUID = 1L; 11 | 12 | private String userId; 13 | 14 | private String roleId; 15 | 16 | public String getUserId() { 17 | return userId; 18 | } 19 | 20 | public void setUserId(String userId) { 21 | this.userId = userId; 22 | } 23 | 24 | public String getRoleId() { 25 | return roleId; 26 | } 27 | 28 | public void setRoleId(String roleId) { 29 | this.roleId = roleId; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/mapper/PermissionMapper.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.mapper; 2 | 3 | import com.test.shiro.entity.Permission; 4 | import org.apache.ibatis.annotations.Mapper; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * @author Created by pangkunkun on 2017/11/20. 12 | */ 13 | @Mapper 14 | @Service 15 | public interface PermissionMapper { 16 | 17 | /** 18 | * 新增权限 19 | * @param permission 20 | * */ 21 | void save(Permission permission); 22 | 23 | /** 24 | * 通过userId获取用户所具有的权限 25 | * @param userId 26 | * @return List 27 | * */ 28 | List findPermissionAndRoleNameByUserId(String userId); 29 | } 30 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_websocket_8_5_23.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__nz_net_ultraq_thymeleaf_thymeleaf_layout_dialect_1_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_theborakompanioni_thymeleaf_extras_shiro_1_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/impl/RoleServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service.impl; 2 | 3 | import com.test.shiro.entity.Role; 4 | import com.test.shiro.service.RoleService; 5 | import org.springframework.stereotype.Service; 6 | 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | /** 11 | * @author Created by pangkunkun on 2017/11/16. 12 | */ 13 | @Service 14 | public class RoleServiceImpl implements RoleService{ 15 | 16 | // @Override 17 | // public Set findAllRolesByUserId(String userId){ 18 | // Set roles=new HashSet<>(); 19 | // roles.add("admin"); 20 | // roles.add("user"); 21 | // return roles; 22 | // } 23 | 24 | @Override 25 | public void save(Role role){ 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /target/classes/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_redis_1_8_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/resources/mapper/UserMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 17 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_starter_1_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_support_4_3_12_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_commons_1_13_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_data_spring_data_keyvalue_1_2_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_web_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_jdbc_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_test_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_spring_boot_mybatis_spring_boot_autoconfigure_1_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_autoconfigure_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_tomcat_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_logging_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/entity/Role.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/15. 7 | */ 8 | public class Role implements Serializable{ 9 | private static final long serialVersionUID = -6140090613812307452L; 10 | 11 | /** 12 | * 角色id 13 | * */ 14 | private String roleId; 15 | 16 | /** 17 | * 角色名称,如:admin,user等 18 | * */ 19 | private String roleName; 20 | 21 | 22 | public String getRoleId() { 23 | return roleId; 24 | } 25 | 26 | public void setRoleId(String roleId) { 27 | this.roleId = roleId; 28 | } 29 | 30 | public String getRoleName() { 31 | return roleName; 32 | } 33 | 34 | public void setRoleName(String roleName) { 35 | this.roleName = roleName; 36 | } 37 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_thymeleaf_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_starter_data_redis_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_boot_spring_boot_test_autoconfigure_1_5_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/entity/RolePermission.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/16. 7 | */ 8 | public class RolePermission implements Serializable{ 9 | private static final long serialVersionUID = 1L; 10 | 11 | /** 12 | * role id 13 | * */ 14 | private String roleId; 15 | 16 | /** 17 | * permission id 18 | * */ 19 | private String permissionId; 20 | 21 | public String getRoleId() { 22 | return roleId; 23 | } 24 | 25 | public void setRoleId(String roleId) { 26 | this.roleId = roleId; 27 | } 28 | 29 | public String getPermissionId() { 30 | return permissionId; 31 | } 32 | 33 | public void setPermissionId(String permissionId) { 34 | this.permissionId = permissionId; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/impl/TokenServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service.impl; 2 | 3 | import com.test.shiro.redis.RedisUtils; 4 | import com.test.shiro.service.TokenService; 5 | import org.apache.shiro.authc.UsernamePasswordToken; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author Created by pangkunkun on 2017/11/19. 11 | */ 12 | @Service 13 | public class TokenServiceImpl implements TokenService{ 14 | 15 | @Autowired 16 | private RedisUtils redisUtils; 17 | 18 | 19 | @Override 20 | public UsernamePasswordToken findByToken(String token){ 21 | 22 | System.out.println("findByToken token:"+token); 23 | System.out.println("findByToken redisUtils:"+redisUtils); 24 | 25 | return (UsernamePasswordToken)redisUtils.get(token); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/util/MD5Utils.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.util; 2 | 3 | import sun.misc.BASE64Encoder; 4 | 5 | import java.io.UnsupportedEncodingException; 6 | import java.security.MessageDigest; 7 | import java.security.NoSuchAlgorithmException; 8 | 9 | /** 10 | * @author Created by pangkunkun on 2017/11/21. 11 | */ 12 | public class MD5Utils { 13 | 14 | /**利用MD5进行加密 15 | * @param str 需要加密的字符串 16 | * @return 加密后的字符串 17 | * @throws NoSuchAlgorithmException 没有这种产生消息摘要的算法 18 | * @throws UnsupportedEncodingException 19 | */ 20 | public static String MD5SendParame(String str) throws NoSuchAlgorithmException, UnsupportedEncodingException{ 21 | //确定计算方法 22 | MessageDigest md5=MessageDigest.getInstance("MD5"); 23 | BASE64Encoder base64en = new BASE64Encoder(); 24 | //加密后的字符串 25 | return base64en.encode(md5.digest(str.getBytes("utf-8"))); 26 | } 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service.impl; 2 | 3 | import com.test.shiro.entity.User; 4 | import com.test.shiro.mapper.UserMapper; 5 | import com.test.shiro.service.UserService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | * @author Created by pangkunkun on 2017/11/16. 11 | */ 12 | @Service 13 | public class UserServiceImpl implements UserService{ 14 | 15 | @Autowired 16 | private UserMapper userMapper; 17 | 18 | @Override 19 | public User findByUsername(String username){ 20 | User user=new User(); 21 | // user.setUserId("userId"); 22 | // user.setUsername("admin"); 23 | // user.setPassword("3ef7164d1f6167cb9f2658c07d3c2f0a"); 24 | // user.setUserId("1"); 25 | // user.setUsername("kun1"); 26 | // user.setPassword("b7465a01fc4f189163c09360ee1142b5"); 27 | // user.setEnable(1); 28 | 29 | return userMapper.findByUsername(username); 30 | } 31 | 32 | @Override 33 | public void save(User user){ 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /target/classes/application.properties: -------------------------------------------------------------------------------- 1 | 2 | server.port=8001 3 | 4 | ######################################################## 5 | ###THYMELEAF (ThymeleafAutoConfiguration) 6 | ######################################################## 7 | #spring.thymeleaf.prefix=classpath:/templates/ 8 | #spring.thymeleaf.suffix=.html 9 | #spring.thymeleaf.mode=HTML5 10 | #spring.thymeleaf.encoding=UTF-8 11 | # ;charset= is added 12 | #spring.thymeleaf.content-type=text/html 13 | # set to false for hot refresh 14 | spring.thymeleaf.cache=false 15 | spring.thymeleaf.mode=LEGACYHTML5 16 | 17 | 18 | mybatis.typeAliasesPackage=com.test.shiro.entity 19 | mybatis.mapperLocations=classpath:mapper/*.xml 20 | 21 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 22 | spring.datasource.url=jdbc:mysql://10.10.20.154:3306/myshiro?characterEncoding=utf8 23 | spring.datasource.username=root 24 | spring.datasource.password=root 25 | #\u6253\u5370\u51FA\u6267\u884C\u7684sql 26 | #mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl 27 | 28 | #redis 29 | #spring.redis.host=localhost 30 | spring.redis.host=10.10.20.154 31 | #spring.redis.password= 32 | spring.redis.port=6379 33 | spring.redis.pool.max-idle=8 34 | spring.redis.pool.min-idle=0 35 | spring.redis.pool.max-active=8 36 | spring.redis.pool.max-wait=-1 37 | #spring.redis.sentinel.master= 38 | #spring.redis.sentinel.nodes= 39 | spring.redis.timeout=60000 -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/service/impl/PermissionServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.service.impl; 2 | 3 | import com.test.shiro.entity.Permission; 4 | import com.test.shiro.mapper.PermissionMapper; 5 | import com.test.shiro.service.PermissionService; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | 13 | /** 14 | * @author Created by pangkunkun on 2017/11/16. 15 | */ 16 | @Service 17 | public class PermissionServiceImpl implements PermissionService{ 18 | 19 | @Autowired 20 | private PermissionMapper permissionMapper; 21 | 22 | @Override 23 | public List findPermissionAndRoleNameByUserId(String userId){ 24 | List permissions=new ArrayList<>(2); 25 | // Permission permission=new Permission(); 26 | // permission.setPermission("permission1"); 27 | // permissions.add(permission); 28 | // permission.setPermission("add"); 29 | // permissions.add(permission); 30 | permissions=permissionMapper.findPermissionAndRoleNameByUserId(userId); 31 | return permissions; 32 | } 33 | 34 | @Override 35 | public void save(Permission permission){ 36 | System.out.println("permission:"+permission.toString()); 37 | permissionMapper.save(permission); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | 2 | server.port=8001 3 | 4 | ######################################################## 5 | ###THYMELEAF (ThymeleafAutoConfiguration) 6 | ######################################################## 7 | #spring.thymeleaf.prefix=classpath:/templates/ 8 | #spring.thymeleaf.suffix=.html 9 | #spring.thymeleaf.mode=HTML5 10 | #spring.thymeleaf.encoding=UTF-8 11 | # ;charset= is added 12 | #spring.thymeleaf.content-type=text/html 13 | # set to false for hot refresh 14 | spring.thymeleaf.cache=false 15 | spring.thymeleaf.mode=LEGACYHTML5 16 | 17 | 18 | mybatis.typeAliasesPackage=com.test.shiro.entity 19 | mybatis.mapperLocations=classpath:mapper/*.xml 20 | 21 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver 22 | spring.datasource.url=jdbc:mysql://10.10.20.154:3306/myshiro?characterEncoding=utf8 23 | spring.datasource.username=root 24 | spring.datasource.password=root 25 | #\u6253\u5370\u51FA\u6267\u884C\u7684sql 26 | #mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl 27 | 28 | #redis 29 | #spring.redis.host=localhost 30 | spring.redis.host=10.10.20.154 31 | #spring.redis.password= 32 | spring.redis.port=6379 33 | spring.redis.pool.max-idle=8 34 | spring.redis.pool.min-idle=0 35 | spring.redis.pool.max-active=8 36 | spring.redis.pool.max-wait=-1 37 | #spring.redis.sentinel.master= 38 | #spring.redis.sentinel.nodes= 39 | spring.redis.timeout=60000 -------------------------------------------------------------------------------- /target/classes/mapper/PermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | INSERT INTO permission(permissionId,permission) VALUES (#{permissionId},#{permission}) 16 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/resources/mapper/PermissionMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | INSERT INTO permission(permissionId,permission) VALUES (#{permissionId},#{permission}) 16 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/entity/Permission.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.entity; 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnore; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author Created by pangkunkun on 2017/11/16. 9 | */ 10 | public class Permission implements Serializable{ 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | /** 15 | * ID 16 | * */ 17 | public Integer permissionId; 18 | 19 | /** 20 | *权限,如:update、delete、add、query等 21 | * */ 22 | public String permission; 23 | 24 | /** 25 | * 角色名称,如:admin,user等 26 | * */ 27 | @JsonIgnore 28 | private String roleName; 29 | 30 | 31 | public Integer getPermissionId() { 32 | return permissionId; 33 | } 34 | 35 | public void setPermissionId(Integer permissionId) { 36 | this.permissionId = permissionId; 37 | } 38 | 39 | public String getPermission() { 40 | return permission; 41 | } 42 | 43 | public void setPermission(String permission) { 44 | this.permission = permission; 45 | } 46 | 47 | public String getRoleName() { 48 | return roleName; 49 | } 50 | 51 | public void setRoleName(String roleName) { 52 | this.roleName = roleName; 53 | } 54 | 55 | @Override 56 | public String toString() { 57 | return "Permission{" + 58 | "permissionId=" + permissionId + 59 | ", permission='" + permission + '\'' + 60 | ", roleName='" + roleName + '\'' + 61 | '}'; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 36 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/controller/DefaultExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.controller; 2 | 3 | import org.apache.shiro.authz.UnauthorizedException; 4 | import org.springframework.http.HttpStatus; 5 | import org.springframework.web.bind.annotation.ControllerAdvice; 6 | import org.springframework.web.bind.annotation.ExceptionHandler; 7 | import org.springframework.web.bind.annotation.ResponseStatus; 8 | import org.springframework.web.context.request.NativeWebRequest; 9 | import org.springframework.web.context.request.ServletWebRequest; 10 | 11 | import javax.servlet.http.HttpServletResponse; 12 | import java.io.IOException; 13 | import java.io.PrintWriter; 14 | 15 | @ControllerAdvice 16 | public class DefaultExceptionHandler { 17 | @ExceptionHandler( { UnauthorizedException.class }) 18 | @ResponseStatus(HttpStatus.UNAUTHORIZED) 19 | public void processUnauthorizedException(NativeWebRequest request, HttpServletResponse response,UnauthorizedException e) { 20 | ServletWebRequest req = (ServletWebRequest)request; 21 | String url = req.getRequest().getRequestURI(); 22 | // return "您无权访问接口:"+url; 23 | try { 24 | String exception = e.getMessage(); 25 | response.setHeader("Content-type", "text/html;charset=UTF-8"); 26 | //这句话的意思,是告诉servlet用UTF-8转码,而不是用默认的ISO8859 27 | response.setCharacterEncoding("UTF-8"); 28 | PrintWriter writer = response.getWriter(); 29 | writer.println("You are not allow to invoke "+url+" method.方法"); 30 | writer.println(exception); 31 | 32 | } catch (IOException e1) { 33 | e1.printStackTrace(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/entity/User.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * @author Created by pangkunkun on 2017/11/15. 7 | */ 8 | public class User implements Serializable { 9 | 10 | private static final long serialVersionUID = -8736616045315083846L; 11 | 12 | /** 13 | * 用户id 14 | * */ 15 | private String userId; 16 | 17 | /** 18 | * 用户名称 19 | * */ 20 | private String username; 21 | 22 | /** 23 | * 密码 24 | * */ 25 | private String password; 26 | 27 | /** 28 | * 是否启用 29 | */ 30 | private Integer enable=0; 31 | 32 | public String getUserId() { 33 | return userId; 34 | } 35 | 36 | public void setUserId(String userId) { 37 | this.userId = userId; 38 | } 39 | 40 | public String getUsername() { 41 | return username; 42 | } 43 | 44 | public void setUsername(String username) { 45 | this.username = username; 46 | } 47 | 48 | public String getPassword() { 49 | return password; 50 | } 51 | 52 | public void setPassword(String password) { 53 | this.password = password; 54 | } 55 | 56 | public Integer getEnable() { 57 | return enable; 58 | } 59 | 60 | public void setEnable(Integer enable) { 61 | this.enable = enable; 62 | } 63 | 64 | @Override 65 | public String toString() { 66 | return "User{" + 67 | "userId=" + userId + 68 | ", username='" + username + '\'' + 69 | ", password='" + password + '\'' + 70 | ", enable=" + enable + 71 | '}'; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/filter/MyFormAuthenticationFilter.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.filter; 2 | 3 | import org.apache.shiro.SecurityUtils; 4 | import org.apache.shiro.authc.UsernamePasswordToken; 5 | import org.apache.shiro.subject.Subject; 6 | import org.apache.shiro.web.filter.authc.FormAuthenticationFilter; 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | 10 | import javax.servlet.ServletRequest; 11 | import javax.servlet.ServletResponse; 12 | 13 | /** 14 | * @author Created by pangkunkun on 2017/11/19. 15 | */ 16 | public class MyFormAuthenticationFilter extends FormAuthenticationFilter{ 17 | 18 | private static final Logger log= LoggerFactory.getLogger(MyFormAuthenticationFilter.class); 19 | 20 | @Override 21 | protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception { 22 | 23 | log.info("MyFormAuthenticationFilter onAccessDenied"); 24 | 25 | Subject subject= SecurityUtils.getSubject(); 26 | UsernamePasswordToken token=new UsernamePasswordToken("admin","admin"); 27 | 28 | subject.login(token); 29 | 30 | System.out.println("dengluchenggong..................."); 31 | 32 | if (this.isLoginRequest(request, response)) { 33 | if (this.isLoginSubmission(request, response)) { 34 | if (log.isTraceEnabled()) { 35 | log.trace("Login submission detected. Attempting to execute login."); 36 | } 37 | 38 | return this.executeLogin(request, response); 39 | } else { 40 | if (log.isTraceEnabled()) { 41 | log.trace("Login page view."); 42 | } 43 | return true; 44 | } 45 | } 46 | 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.controller; 2 | 3 | import com.test.shiro.entity.Permission; 4 | import com.test.shiro.service.PermissionService; 5 | import org.apache.shiro.SecurityUtils; 6 | import org.apache.shiro.authz.UnauthorizedException; 7 | import org.apache.shiro.authz.annotation.Logical; 8 | import org.apache.shiro.authz.annotation.RequiresPermissions; 9 | import org.apache.shiro.authz.annotation.RequiresRoles; 10 | import org.apache.shiro.subject.Subject; 11 | import org.slf4j.Logger; 12 | import org.slf4j.LoggerFactory; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.web.bind.annotation.GetMapping; 15 | import org.springframework.web.bind.annotation.PostMapping; 16 | import org.springframework.web.bind.annotation.RestController; 17 | 18 | /** 19 | * @author Created by pangkunkun on 2017/11/16. 20 | */ 21 | @RestController 22 | public class UserController { 23 | 24 | private static final Logger log= LoggerFactory.getLogger(UserController.class); 25 | 26 | @Autowired 27 | private PermissionService permissionService; 28 | 29 | @GetMapping("/users") 30 | @RequiresRoles(value={"admin","user"},logical = Logical.OR) 31 | @RequiresPermissions(value={"add","update"},logical = Logical.OR) 32 | public String getUserInfo(){ 33 | 34 | log.info("into getUserInfo"); 35 | // Subject subject= SecurityUtils.getSubject(); 36 | // try { 37 | // subject.checkPermissions("add","update"); 38 | // }catch (UnauthorizedException e){ 39 | // log.info("错误信息:"+e.getMessage()); 40 | // //TODO 定义错误处理页面 41 | // log.info("权限不足"); 42 | // } 43 | 44 | log.info("..............................."); 45 | 46 | return "Success to get user info"; 47 | } 48 | 49 | 50 | @PostMapping("/permission") 51 | public Permission createPermission(){ 52 | System.out.println("createPermission"); 53 | Permission permission=new Permission(); 54 | permission.setPermission("add"); 55 | permissionService.save(permission); 56 | return permission; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/shiro/MyUsernamePasswordToken.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.shiro; 2 | 3 | import org.apache.shiro.authc.UsernamePasswordToken; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * @author Created by pangkunkun on 2017/11/20. 9 | */ 10 | public class MyUsernamePasswordToken extends UsernamePasswordToken { 11 | 12 | private String username; 13 | private Map params; 14 | private String signature; 15 | private String type; 16 | 17 | public MyUsernamePasswordToken(String username, Map params, String signature) { 18 | this.username = username; 19 | this.params = params; 20 | this.signature = signature; 21 | } 22 | 23 | public MyUsernamePasswordToken(String username, String type, String signature) { 24 | this.username = username; 25 | this.type = type; 26 | this.signature = signature; 27 | } 28 | 29 | public MyUsernamePasswordToken(String username, String signature) { 30 | this.username = username; 31 | this.signature = signature; 32 | } 33 | 34 | @Override 35 | public String getUsername() { 36 | return username; 37 | } 38 | 39 | @Override 40 | public void setUsername(String username) { 41 | this.username = username; 42 | } 43 | 44 | public Map getParams() { 45 | return params; 46 | } 47 | 48 | public void setParams(Map params) { 49 | this.params = params; 50 | } 51 | 52 | public String getSignature() { 53 | return signature; 54 | } 55 | 56 | public void setSignature(String signature) { 57 | this.signature = signature; 58 | } 59 | 60 | public String getType() { 61 | return type; 62 | } 63 | 64 | public void setType(String type) { 65 | this.type = type; 66 | } 67 | 68 | @Override 69 | public Object getPrincipal() { 70 | return username; 71 | } 72 | 73 | @Override 74 | public Object getCredentials() { 75 | return signature; 76 | } 77 | 78 | @Override 79 | public String toString() { 80 | return "MyUsernamePasswordToken{" + 81 | "username='" + username + '\'' + 82 | ", params=" + params + 83 | ", type=" + type + 84 | ", signature='" + signature + '\'' + 85 | '}'; 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/controller/SimpleErrorController.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.controller; 2 | 3 | /** 4 | * Created by YFH on 2017/2/22. 5 | */ 6 | 7 | import org.slf4j.Logger; 8 | import org.slf4j.LoggerFactory; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.boot.autoconfigure.web.ErrorAttributes; 11 | import org.springframework.boot.autoconfigure.web.ErrorController; 12 | import org.springframework.util.Assert; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RestController; 15 | import org.springframework.web.context.request.RequestAttributes; 16 | import org.springframework.web.context.request.ServletRequestAttributes; 17 | 18 | import javax.servlet.http.HttpServletRequest; 19 | import java.util.Map; 20 | 21 | @RestController 22 | @RequestMapping("/error") 23 | public class SimpleErrorController implements ErrorController { 24 | 25 | private static final Logger logger = LoggerFactory.getLogger(SimpleErrorController.class); 26 | 27 | private final ErrorAttributes errorAttributes; 28 | 29 | @Autowired 30 | public SimpleErrorController(ErrorAttributes errorAttributes) { 31 | Assert.notNull(errorAttributes, "ErrorAttributes must not be null"); 32 | this.errorAttributes = errorAttributes; 33 | } 34 | 35 | @Override 36 | public String getErrorPath() { 37 | return "/error"; 38 | } 39 | 40 | @RequestMapping 41 | public Map error(HttpServletRequest aRequest){ 42 | Map body = getErrorAttributes(aRequest,getTraceParameter(aRequest)); 43 | String trace = (String) body.get("trace"); 44 | if(trace != null){ 45 | String[] lines = trace.split("\n\t"); 46 | body.put("trace", lines); 47 | } 48 | 49 | return body; 50 | } 51 | 52 | private boolean getTraceParameter(HttpServletRequest request) { 53 | String parameter = request.getParameter("trace"); 54 | if (parameter == null) { 55 | return false; 56 | } 57 | return !"false".equals(parameter.toLowerCase()); 58 | } 59 | 60 | private Map getErrorAttributes(HttpServletRequest aRequest, boolean includeStackTrace) { 61 | RequestAttributes requestAttributes = new ServletRequestAttributes(aRequest); 62 | return errorAttributes.getErrorAttributes(requestAttributes, includeStackTrace); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/shiro/MyModularRealmAuthenticator.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.shiro; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Collection; 5 | import java.util.HashMap; 6 | 7 | import org.apache.shiro.authc.AuthenticationException; 8 | import org.apache.shiro.authc.AuthenticationInfo; 9 | import org.apache.shiro.authc.AuthenticationToken; 10 | import org.apache.shiro.authc.pam.ModularRealmAuthenticator; 11 | import org.apache.shiro.realm.Realm; 12 | 13 | /** 14 | * @author Created by pangkunkun on 2017/11/22. 15 | * 自定义Authenticator 16 | * 注意,当需要分别定义处理普通用户和管理员验证的Realm时,对应Realm的全类名应该包含字符串“User”,或者“Admin”。 17 | * 并且,他们不能相互包含,例如,处理普通用户验证的Realm的全类名中不应该包含字符串"Admin"。 18 | */ 19 | public class MyModularRealmAuthenticator extends ModularRealmAuthenticator { 20 | 21 | @Override 22 | protected AuthenticationInfo doAuthenticate(AuthenticationToken authenticationToken) 23 | throws AuthenticationException { 24 | 25 | System.out.println("AuthenticationInfo doAuthenticate"); 26 | 27 | // 判断getRealms()是否返回为空 28 | assertRealmsConfigured(); 29 | 30 | MyUsernamePasswordToken token=(MyUsernamePasswordToken)authenticationToken; 31 | // 登录类型 32 | String loginType = token.getType(); 33 | 34 | System.out.println("loginType:"+loginType); 35 | // 所有Realm 36 | Collection realms = getRealms(); 37 | // 登录类型对应的所有Realm 38 | Collection typeRealms = new ArrayList<>(); 39 | HashMap realmHashMap=new HashMap<>(realms.size()); 40 | for (Realm realm : realms) { 41 | realmHashMap.put(realm.getName(),realm); 42 | // if (realm.getName().contains(loginType)){ 43 | // typeRealms.add(realm); 44 | // } 45 | 46 | } 47 | 48 | System.out.println("realmHashMap.get(loginType):"+realmHashMap.get(loginType)); 49 | 50 | if (realmHashMap.get(loginType)!=null){ 51 | return doSingleRealmAuthentication(realmHashMap.get(loginType), token); 52 | }else { 53 | return doMultiRealmAuthentication(realms, token); 54 | } 55 | 56 | // 判断是单Realm还是多Realm 57 | // if (typeRealms.size() == 1) 58 | // return doSingleRealmAuthentication(typeRealms.iterator().next(), token); 59 | // else 60 | // return doMultiRealmAuthentication(typeRealms, token); 61 | } 62 | 63 | // private static HashMap switchCollectionToMap(){ 64 | // HashMap 65 | // 66 | // return 67 | // } 68 | 69 | } -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.test.shiro 8 | shiro-demo 9 | 1.0-SNAPSHOT 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 1.5.8.RELEASE 15 | 16 | 17 | 18 | 19 | UTF-8 20 | UTF-8 21 | 1.8 22 | 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-web 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter-data-redis 32 | 33 | 34 | mysql 35 | mysql-connector-java 36 | 37 | 38 | org.mybatis.spring.boot 39 | mybatis-spring-boot-starter 40 | 1.3.1 41 | 42 | 43 | org.apache.shiro 44 | shiro-spring 45 | 1.4.0 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | 54 | junit 55 | junit 56 | 4.12 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-maven-plugin 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/redis/RedisCache.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.redis; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.cache.annotation.CachingConfigurerSupport; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | import org.springframework.data.redis.connection.RedisConnectionFactory; 8 | import org.springframework.data.redis.core.HashOperations; 9 | import org.springframework.data.redis.core.RedisTemplate; 10 | import org.springframework.data.redis.core.ValueOperations; 11 | import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; 12 | import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer; 13 | import org.springframework.data.redis.serializer.StringRedisSerializer; 14 | 15 | /** 16 | *@author Created by pkk on 2017/11/20. 17 | */ 18 | @Configuration 19 | public class RedisCache extends CachingConfigurerSupport { 20 | 21 | 22 | /** 23 | * 注入 RedisConnectionFactory 24 | */ 25 | @Autowired 26 | RedisConnectionFactory redisConnectionFactory; 27 | 28 | 29 | @Bean 30 | public RedisTemplate redisTemplate(){ 31 | RedisTemplate redisTemplate = new RedisTemplate<>(); 32 | initDomainRedisTemplate(redisTemplate, redisConnectionFactory); 33 | return redisTemplate; 34 | } 35 | 36 | /** 37 | * 设置数据存入 redis 的序列化方式 38 | * 39 | * @param redisTemplate 40 | * @param factory 41 | */ 42 | private void initDomainRedisTemplate(RedisTemplate redisTemplate, RedisConnectionFactory factory) { 43 | redisTemplate.setKeySerializer(new StringRedisSerializer()); 44 | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); 45 | redisTemplate.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); 46 | redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer()); 47 | redisTemplate.setConnectionFactory(factory); 48 | } 49 | 50 | 51 | /** 52 | * 实例化 HashOperations 对象,可以使用 Hash 类型操作 53 | * 54 | * @param redisTemplate 55 | * @return 56 | */ 57 | @Bean 58 | public HashOperations hashOperations(RedisTemplate redisTemplate) { 59 | return redisTemplate.opsForHash(); 60 | } 61 | 62 | /** 63 | * 实例化 ValueOperations 对象,可以使用 String 操作 64 | * 65 | * @param redisTemplate 66 | * @return 67 | */ 68 | @Bean 69 | public ValueOperations valueOperations(RedisTemplate redisTemplate) { 70 | return redisTemplate.opsForValue(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/shiro/MyShiroRealm2.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.shiro; 2 | 3 | import com.test.shiro.entity.Permission; 4 | import com.test.shiro.entity.User; 5 | import com.test.shiro.service.PermissionService; 6 | import com.test.shiro.service.UserService; 7 | import org.apache.shiro.SecurityUtils; 8 | import org.apache.shiro.authc.*; 9 | import org.apache.shiro.authz.AuthorizationInfo; 10 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 11 | import org.apache.shiro.realm.AuthorizingRealm; 12 | import org.apache.shiro.subject.PrincipalCollection; 13 | import org.springframework.beans.factory.annotation.Autowired; 14 | import org.springframework.context.annotation.Configuration; 15 | 16 | import java.util.List; 17 | 18 | /** 19 | * @author Created by pangkunkun on 2017/11/15. 20 | */ 21 | @Configuration 22 | public class MyShiroRealm2 extends AuthorizingRealm{ 23 | 24 | @Autowired 25 | private UserService userService; 26 | 27 | @Autowired 28 | private PermissionService permissionService; 29 | 30 | @Override 31 | public String getName() { 32 | return "myShiroRealm2"; 33 | } 34 | 35 | //认证 36 | @Override 37 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { 38 | 39 | System.out.println("doGetAuthenticationInfo2"); 40 | MyUsernamePasswordToken myToken=(MyUsernamePasswordToken)token; 41 | //获取用户的输入的账号. 42 | String username = (String)myToken.getPrincipal(); 43 | //实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法 44 | User user = userService.findByUsername(username); 45 | System.out.println(user.toString()); 46 | if(user==null){ 47 | throw new UnknownAccountException(); 48 | } 49 | 50 | //此处使用的是user对象,不是username 51 | SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo( 52 | user, 53 | user.getPassword(), 54 | getName() 55 | ); 56 | return authenticationInfo; 57 | } 58 | 59 | 60 | //授权 61 | @Override 62 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { 63 | System.out.println("doGetAuthorizationInfo2"); 64 | //User{id=1, username='admin', password='3ef7164d1f6167cb9f2658c07d3c2f0a', enable=1} 65 | User user= (User) SecurityUtils.getSubject().getPrincipal(); 66 | 67 | List permissions=permissionService.findPermissionAndRoleNameByUserId(user.getUserId()); 68 | System.out.println("permissions:"+permissions.size()); 69 | // List roles=permissionService.findPermissionByUserId(user.getUserId()); 70 | // 权限信息对象info,用来存放查出的用户的所有的角色(role)及权限(permission) 71 | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); 72 | for(Permission permission: permissions){ 73 | info.addStringPermission(permission.getPermission()); 74 | info.addRole(permission.getRoleName()); 75 | } 76 | return info; 77 | } 78 | 79 | } -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/redis/RedisUtils.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.redis; 2 | 3 | import org.springframework.data.redis.core.*; 4 | import org.springframework.stereotype.Component; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | import javax.annotation.Resource; 8 | import java.util.HashMap; 9 | import java.util.Set; 10 | 11 | /** 12 | *@author Created by Administrator on 2017/11/20. 13 | */ 14 | @Component 15 | public class RedisUtils { 16 | 17 | @Resource 18 | protected HashOperations hashOperations; 19 | 20 | @Resource 21 | protected RedisTemplate redisTemplate; 22 | 23 | @Resource 24 | protected ValueOperations valueOperations; 25 | 26 | 27 | /** 28 | * 查询key,支持模糊查询 29 | * 30 | * @param key 传过来时key的前后端已经加入了*,或者根据具体处理 31 | * */ 32 | public Set keys(String key){ 33 | 34 | return redisTemplate.keys(key); 35 | } 36 | 37 | /** 38 | * 重命名key 39 | * */ 40 | public void renameKey(String key,String newKey){ 41 | redisTemplate.rename(key,newKey); 42 | } 43 | 44 | /** 45 | *字符串添加信息 46 | * @param key 47 | * @param obj 可以是单个的值,也可以是任意类型的对象 48 | * */ 49 | public void set(String key,Object obj){ 50 | valueOperations.set(key,obj); 51 | } 52 | 53 | /** 54 | * 字符串获取值 55 | * @param key 56 | * */ 57 | public Object get(String key){ 58 | return valueOperations.get(key); 59 | } 60 | 61 | /** 62 | * 删出key 63 | * 这里跟下边deleteKey()最底层实现都是一样的,应该可以通用 64 | * @param key 65 | * */ 66 | public void delete(String key){ 67 | valueOperations.getOperations().delete(key); 68 | } 69 | 70 | /** 71 | * 添加单个 72 | * 73 | * @param key key 74 | * @param filed filed 75 | * @param domain 对象 76 | */ 77 | public void hset(String key,String filed,Object domain){ 78 | hashOperations.put(key, filed, domain); 79 | } 80 | 81 | 82 | /** 83 | * 添加HashMap 84 | * 85 | * @param key key 86 | * @param hm 要存入的hash表 87 | */ 88 | public void hset(String key, HashMap hm){ 89 | hashOperations.putAll(key,hm); 90 | } 91 | 92 | /** 93 | * 查询key和field所确定的值 94 | * 95 | * @param key 查询的key 96 | * @param field 查询的field 97 | * @return HV 98 | */ 99 | public Object hget(String key,String field) { 100 | return hashOperations.get(key, field); 101 | } 102 | 103 | /** 104 | * 查询该key下所有值 105 | * 106 | * @param key 查询的key 107 | * @return Map 108 | */ 109 | public Object hget(String key) { 110 | return hashOperations.entries(key); 111 | } 112 | 113 | /** 114 | * 删除key下所有值 115 | * 116 | * @param key 查询的key 117 | */ 118 | public void deleteKey(String key) { 119 | hashOperations.getOperations().delete(key); 120 | } 121 | 122 | /** 123 | * 判断key和field下是否有值 124 | * 125 | * @param key 判断的key 126 | * @param field 判断的field 127 | */ 128 | public Boolean hasKey(String key,String field) { 129 | return hashOperations.hasKey(key,field); 130 | } 131 | 132 | /** 133 | * 判断key下是否有值 134 | * 135 | * @param key 判断的key 136 | */ 137 | public Boolean hasKey(String key) { 138 | return hashOperations.getOperations().hasKey(key); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/filter/MyAccessControlFilter.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.filter; 2 | 3 | import com.test.shiro.constant.Constant; 4 | import com.test.shiro.shiro.MyUsernamePasswordToken; 5 | import com.test.shiro.util.MD5Utils; 6 | import org.apache.shiro.SecurityUtils; 7 | import org.apache.shiro.subject.Subject; 8 | import org.apache.shiro.web.filter.AccessControlFilter; 9 | import org.slf4j.Logger; 10 | import org.slf4j.LoggerFactory; 11 | 12 | import javax.servlet.ServletRequest; 13 | import javax.servlet.ServletResponse; 14 | import javax.servlet.http.HttpServletResponse; 15 | import java.io.IOException; 16 | 17 | /** 18 | * @author Created by pangkunkun on 2017/11/18. 19 | */ 20 | public class MyAccessControlFilter extends AccessControlFilter { 21 | 22 | private static final Logger log= LoggerFactory.getLogger(MyAccessControlFilter.class); 23 | 24 | 25 | /** 26 | * 27 | * 表示是否允许访问;mappedValue就是[urls]配置中拦截器参数部分,如果允许访问返回true,否则false; 28 | * (感觉这里应该是对白名单(不需要登录的接口)放行的) 29 | * 如果isAccessAllowed返回true则onAccessDenied方法不会继续执行 30 | * 这里可以用来判断一些不被通过的链接(个人备注) 31 | * * 表示是否允许访问 ,如果允许访问返回true,否则false; 32 | * @param servletRequest 33 | * @param servletResponse 34 | * @param object 表示写在拦截器中括号里面的字符串 mappedValue 就是 [urls] 配置中拦截器参数部分 35 | * @return 36 | * @throws Exception 37 | * */ 38 | @Override 39 | public boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object object) throws Exception{ 40 | // Subject subject = getSubject(servletRequest,servletResponse); 41 | // String url = getPathWithinApplication(servletRequest); 42 | // log.info("当前用户正在访问的 url => " + url); 43 | // log.info("subject.isPermitted(url);"+subject.isPermitted(url)); 44 | return false; 45 | } 46 | 47 | /** 48 | * 表示当访问拒绝时是否已经处理了;如果返回true表示需要继续处理;如果返回false表示该拦截器实例已经处理了,将直接返回即可。 49 | * onAccessDenied是否执行取决于isAccessAllowed的值,如果返回true则onAccessDenied不会执行;如果返回false,执行onAccessDenied 50 | * 如果onAccessDenied也返回false,则直接返回,不会进入请求的方法(只有isAccessAllowed和onAccessDenied的情况下) 51 | * */ 52 | @Override 53 | public boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception{ 54 | System.out.println("onAccessDenied"); 55 | String username=request.getParameter(Constant.CRS_KEY); 56 | String signature=request.getParameter(Constant.SIGNATURE); 57 | 58 | String type=request.getParameter("type"); 59 | 60 | //TODO 通过其它参数验证signature的正确性 61 | String digestValue=MD5Utils.MD5SendParame(signature); 62 | 63 | MyUsernamePasswordToken token=new MyUsernamePasswordToken(username,type, digestValue); 64 | 65 | System.out.println("token.getType():"+token.getType()); 66 | 67 | 68 | // MyUsernamePasswordToken token=new MyUsernamePasswordToken(username, signature); 69 | Subject subject= SecurityUtils.getSubject(); 70 | try { 71 | subject.login(token); 72 | }catch (Exception e){ 73 | log.info("登陆失败"); 74 | log.info(e.getMessage()); 75 | onLoginFail(response); 76 | return false; 77 | } 78 | log.info("登陆成功"); 79 | return true; 80 | } 81 | 82 | /** 83 | * 登录失败 84 | * */ 85 | private void onLoginFail(ServletResponse response) throws IOException { 86 | log.info("设置返回"); 87 | HttpServletResponse httpResponse = (HttpServletResponse) response; 88 | httpResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); 89 | // httpResponse.getWriter().write("login error"); 90 | } 91 | 92 | /** 93 | * TODO 跨域请求 94 | */ 95 | private void dealCrossDomain(){ 96 | 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/shiro/MyShiroRealm.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.shiro; 2 | 3 | import com.test.shiro.entity.Permission; 4 | import com.test.shiro.entity.User; 5 | import com.test.shiro.service.PermissionService; 6 | import com.test.shiro.service.UserService; 7 | import com.test.shiro.util.MD5Utils; 8 | import org.apache.shiro.SecurityUtils; 9 | import org.apache.shiro.authc.*; 10 | import org.apache.shiro.authz.AuthorizationInfo; 11 | import org.apache.shiro.authz.SimpleAuthorizationInfo; 12 | import org.apache.shiro.realm.AuthorizingRealm; 13 | import org.apache.shiro.subject.PrincipalCollection; 14 | import org.springframework.beans.factory.annotation.Autowired; 15 | import org.springframework.context.annotation.Configuration; 16 | 17 | import java.util.List; 18 | 19 | /** 20 | * @author Created by pangkunkun on 2017/11/15. 21 | */ 22 | @Configuration 23 | public class MyShiroRealm extends AuthorizingRealm{ 24 | 25 | @Autowired 26 | private UserService userService; 27 | 28 | @Autowired 29 | private PermissionService permissionService; 30 | 31 | @Override 32 | public String getName() { 33 | return "myShiroRealm1"; 34 | } 35 | 36 | //认证 37 | @Override 38 | protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException { 39 | 40 | System.out.println("doGetAuthenticationInfo1"); 41 | MyUsernamePasswordToken myToken=(MyUsernamePasswordToken)token; 42 | //获取用户的输入的账号. 43 | String username = (String)myToken.getPrincipal(); 44 | //实际项目中,这里可以根据实际情况做缓存,如果不做,Shiro自己也是有时间间隔机制,2分钟内不会重复执行该方法 45 | User user = userService.findByUsername(username); 46 | System.out.println(user.toString()); 47 | if(user==null){ 48 | throw new UnknownAccountException(); 49 | } 50 | // if (0==user.getEnable()) { 51 | // // 帐号锁定 52 | // throw new LockedAccountException(); 53 | // } 54 | 55 | System.out.println("myToken.getSignature():"+myToken.getSignature()); 56 | System.out.println("user.getPassword():"+user.getPassword()); 57 | 58 | //此处使用的是user对象,不是username 59 | SimpleAuthenticationInfo authenticationInfo = new SimpleAuthenticationInfo( 60 | user, 61 | user.getPassword(), 62 | getName() 63 | ); 64 | System.out.println("authenticationInfo:"+authenticationInfo); 65 | 66 | return authenticationInfo; 67 | } 68 | 69 | 70 | //授权 71 | @Override 72 | protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) { 73 | System.out.println("doGetAuthorizationInfo1"); 74 | //User{id=1, username='admin', password='3ef7164d1f6167cb9f2658c07d3c2f0a', enable=1} 75 | User user= (User) SecurityUtils.getSubject().getPrincipal(); 76 | 77 | List permissions=permissionService.findPermissionAndRoleNameByUserId(user.getUserId()); 78 | System.out.println("permissions:"+permissions.size()); 79 | // List roles=permissionService.findPermissionByUserId(user.getUserId()); 80 | // 权限信息对象info,用来存放查出的用户的所有的角色(role)及权限(permission) 81 | SimpleAuthorizationInfo info = new SimpleAuthorizationInfo(); 82 | //这里赋给两个不存在的值,使controller中的权限验证失败,验证在此失败会继续进入myShiroRealm2验证权限 83 | info.addRole("as"); 84 | info.addStringPermission("sdf"); 85 | // for(Permission permission: permissions){ 86 | // System.out.println("permission:"+permission.getPermission()); 87 | // System.out.println("permission.getRoleName():"+permission.getRoleName()); 88 | // info.addStringPermission(permission.getPermission()); 89 | // info.addRole(permission.getRoleName()); 90 | // } 91 | return info; 92 | } 93 | 94 | } -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/controller/HomeController.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.controller; 2 | 3 | import com.test.shiro.entity.User; 4 | import org.apache.shiro.SecurityUtils; 5 | import org.apache.shiro.authc.AuthenticationException; 6 | import org.apache.shiro.authc.LockedAccountException; 7 | import org.apache.shiro.authc.UsernamePasswordToken; 8 | import org.apache.shiro.subject.Subject; 9 | import org.springframework.stereotype.Controller; 10 | import org.springframework.ui.Model; 11 | import org.springframework.util.StringUtils; 12 | import org.springframework.web.bind.annotation.GetMapping; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.bind.annotation.RequestMethod; 15 | import org.springframework.web.bind.annotation.ResponseBody; 16 | 17 | import javax.servlet.http.HttpServletRequest; 18 | 19 | 20 | /** 21 | * @author Created by pangkunkun on 2017/11/16. 22 | */ 23 | @Controller 24 | public class HomeController { 25 | @RequestMapping(value="/login",method= RequestMethod.GET) 26 | public String login(){ 27 | System.out.println("This is login"); 28 | return "login"; 29 | } 30 | 31 | 32 | @RequestMapping(value="/login2",method= RequestMethod.GET) 33 | public String login2(){ 34 | 35 | System.out.println("This is login2"); 36 | String username="admin"; 37 | String password="admin"; 38 | Subject subject = SecurityUtils.getSubject(); 39 | UsernamePasswordToken token=new UsernamePasswordToken(username,password,true); 40 | 41 | System.out.println("before login2 subject"); 42 | subject.login(token); 43 | System.out.println("after login2 subject"); 44 | return "redirect:usersPage"; 45 | } 46 | 47 | @RequestMapping(value="/login",method=RequestMethod.POST) 48 | public String login(HttpServletRequest request, User user, Model model){ 49 | System.out.println("sadrwe"); 50 | System.out.println("user.getUsername():"+user.getUsername()); 51 | System.out.println("user.getPassword():"+user.getPassword()); 52 | if (StringUtils.isEmpty(user.getUsername()) || StringUtils.isEmpty(user.getPassword())) { 53 | request.setAttribute("msg", "用户名或密码不能为空!"); 54 | return "login"; 55 | } 56 | Subject subject = SecurityUtils.getSubject(); 57 | subject.isAuthenticated(); 58 | UsernamePasswordToken token=new UsernamePasswordToken(user.getUsername(),user.getPassword()); 59 | try { 60 | // System.out.println("token.isRememberMe():"+token.isRememberMe()); 61 | System.out.println("before subject"); 62 | // subject.login(token); 63 | System.out.println("after subject"); 64 | return "redirect:usersPage"; 65 | }catch (LockedAccountException lae) { 66 | token.clear(); 67 | request.setAttribute("msg", "用户已经被锁定不能登录,请与管理员联系!"); 68 | return "login"; 69 | } catch (AuthenticationException e) { 70 | token.clear(); 71 | request.setAttribute("msg", "用户或密码不正确!"); 72 | return "login"; 73 | } 74 | } 75 | 76 | @GetMapping("/token") 77 | @ResponseBody 78 | public UsernamePasswordToken createToken(){ 79 | System.out.println("createToken"); 80 | Subject subject = SecurityUtils.getSubject(); 81 | UsernamePasswordToken token=new UsernamePasswordToken("kun","123",true); 82 | System.out.println("token:"+token); 83 | subject.login(token); 84 | System.out.println("over"); 85 | return token; 86 | } 87 | 88 | @RequestMapping(value={"/usersPage",""}) 89 | public String usersPage(){ 90 | return "user/users"; 91 | } 92 | 93 | @RequestMapping("/rolesPage") 94 | public String rolesPage(){ 95 | return "role/roles"; 96 | } 97 | 98 | @RequestMapping("/resourcesPage") 99 | public String resourcesPage(){ 100 | return "resources/resources"; 101 | } 102 | 103 | @RequestMapping("/403") 104 | public String forbidden(){ 105 | return "403"; 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/shiro/ShiroService.java: -------------------------------------------------------------------------------- 1 | //package com.test.shiro.shiro; 2 | // 3 | // 4 | //import org.apache.shiro.spring.web.ShiroFilterFactoryBean; 5 | //import org.apache.shiro.web.filter.mgt.DefaultFilterChainManager; 6 | //import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver; 7 | //import org.apache.shiro.web.servlet.AbstractShiroFilter; 8 | //import org.springframework.beans.factory.annotation.Autowired; 9 | //import org.springframework.stereotype.Service; 10 | // 11 | //import java.util.LinkedHashMap; 12 | //import java.util.Map; 13 | // 14 | ///** 15 | // * Created by yangqj on 2017/4/30. 16 | // */ 17 | //@Service 18 | //public class ShiroService { 19 | // 20 | // @Autowired 21 | // private ShiroFilterFactoryBean shiroFilterFactoryBean; 22 | //// @Autowired 23 | //// private ResourcesService resourcesService; 24 | //// @Autowired 25 | //// private RedisSessionDAO redisSessionDAO; 26 | // /** 27 | // * 初始化权限 28 | // */ 29 | // public Map loadFilterChainDefinitions() { 30 | // // 权限控制map.从数据库获取 31 | // Map filterChainDefinitionMap = new LinkedHashMap(); 32 | // filterChainDefinitionMap.put("/logout", "logout"); 33 | // filterChainDefinitionMap.put("/css/**","anon"); 34 | // filterChainDefinitionMap.put("/js/**","anon"); 35 | // filterChainDefinitionMap.put("/img/**","anon"); 36 | // filterChainDefinitionMap.put("/font-awesome/**","anon"); 37 | //// List resourcesList = resourcesService.queryAll(); 38 | //// for(Resources resources:resourcesList){ 39 | //// 40 | //// if (StringUtil.isNotEmpty(resources.getResurl())) { 41 | //// String permission = "perms[" + resources.getResurl()+ "]"; 42 | //// filterChainDefinitionMap.put(resources.getResurl(),permission); 43 | //// } 44 | //// } 45 | // filterChainDefinitionMap.put("/**", "authc"); 46 | // return filterChainDefinitionMap; 47 | // } 48 | // 49 | // /** 50 | // * 重新加载权限 51 | // */ 52 | // public void updatePermission() { 53 | // 54 | // synchronized (shiroFilterFactoryBean) { 55 | // 56 | // AbstractShiroFilter shiroFilter = null; 57 | // try { 58 | // shiroFilter = (AbstractShiroFilter) shiroFilterFactoryBean 59 | // .getObject(); 60 | // } catch (Exception e) { 61 | // throw new RuntimeException( 62 | // "get ShiroFilter from shiroFilterFactoryBean error!"); 63 | // } 64 | // 65 | // PathMatchingFilterChainResolver filterChainResolver = (PathMatchingFilterChainResolver) shiroFilter 66 | // .getFilterChainResolver(); 67 | // DefaultFilterChainManager manager = (DefaultFilterChainManager) filterChainResolver 68 | // .getFilterChainManager(); 69 | // 70 | // // 清空老的权限控制 71 | // manager.getFilterChains().clear(); 72 | // 73 | // shiroFilterFactoryBean.getFilterChainDefinitionMap().clear(); 74 | // shiroFilterFactoryBean 75 | // .setFilterChainDefinitionMap(loadFilterChainDefinitions()); 76 | // // 重新构建生成 77 | // Map chains = shiroFilterFactoryBean 78 | // .getFilterChainDefinitionMap(); 79 | // for (Map.Entry entry : chains.entrySet()) { 80 | // String url = entry.getKey(); 81 | // String chainDefinition = entry.getValue().trim() 82 | // .replace(" ", ""); 83 | // manager.createChain(url, chainDefinition); 84 | // } 85 | // 86 | // System.out.println("更新权限成功!!"); 87 | // } 88 | // } 89 | // 90 | // /** 91 | // * 根据userId 清除当前session存在的用户的权限缓存 92 | // * @param userIds 已经修改了权限的userId 93 | // */ 94 | // /* public void clearUserAuthByUserId(List userIds){ 95 | // if(null == userIds || userIds.size() == 0) return ; 96 | // //获取所有session 97 | // Collection sessions = redisSessionDAO.getActiveSessions(); 98 | // //定义返回 99 | // List list = new ArrayList(); 100 | // for (Session session:sessions){ 101 | // //获取session登录信息。 102 | // Object obj = session.getAttribute(DefaultSubjectContext.PRINCIPALS_SESSION_KEY); 103 | // if(null != obj && obj instanceof SimplePrincipalCollection){ 104 | // //强转 105 | // SimplePrincipalCollection spc = (SimplePrincipalCollection)obj; 106 | // //判断用户,匹配用户ID。 107 | // obj = spc.getPrimaryPrincipal(); 108 | // if(null != obj && obj instanceof User){ 109 | // User user = (User) obj; 110 | // System.out.println("user:"+user); 111 | // //比较用户ID,符合即加入集合 112 | // if(null != user && userIds.contains(user.getId())){ 113 | // list.add(spc); 114 | // } 115 | // } 116 | // } 117 | // } 118 | // RealmSecurityManager securityManager = 119 | // (RealmSecurityManager) SecurityUtils.getSecurityManager(); 120 | // MyShiroRealm realm = (MyShiroRealm)securityManager.getRealms().iterator().next(); 121 | // for (SimplePrincipalCollection simplePrincipalCollection : list) { 122 | // realm.clearCachedAuthorizationInfo(simplePrincipalCollection); 123 | // } 124 | // }*/ 125 | //} 126 | -------------------------------------------------------------------------------- /src/main/java/com/test/shiro/config/ShiroConfig.java: -------------------------------------------------------------------------------- 1 | package com.test.shiro.config; 2 | 3 | import com.test.shiro.filter.MyAccessControlFilter; 4 | import com.test.shiro.shiro.MyModularRealmAuthenticator; 5 | import com.test.shiro.shiro.MyShiroRealm; 6 | import com.test.shiro.shiro.MyShiroRealm2; 7 | import org.apache.shiro.authc.credential.HashedCredentialsMatcher; 8 | import org.apache.shiro.authc.pam.AtLeastOneSuccessfulStrategy; 9 | import org.apache.shiro.authc.pam.ModularRealmAuthenticator; 10 | import org.apache.shiro.mgt.SecurityManager; 11 | import org.apache.shiro.realm.Realm; 12 | import org.apache.shiro.spring.LifecycleBeanPostProcessor; 13 | import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor; 14 | import org.apache.shiro.spring.web.ShiroFilterFactoryBean; 15 | import org.apache.shiro.web.mgt.DefaultWebSecurityManager; 16 | import org.slf4j.Logger; 17 | import org.slf4j.LoggerFactory; 18 | import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; 19 | import org.springframework.context.annotation.Bean; 20 | import org.springframework.context.annotation.Configuration; 21 | 22 | import javax.servlet.Filter; 23 | import java.util.*; 24 | 25 | /** 26 | * @author Created by pangkunkun on 2017/11/15. 27 | */ 28 | @Configuration 29 | public class ShiroConfig { 30 | 31 | private static final Logger log= LoggerFactory.getLogger(ShiroConfig.class); 32 | 33 | 34 | @Bean 35 | public static LifecycleBeanPostProcessor getLifecycleBeanPostProcessor() { 36 | return new LifecycleBeanPostProcessor(); 37 | } 38 | 39 | @Bean 40 | public static DefaultAdvisorAutoProxyCreator getDefaultAdvisorAutoProxyCreator(){ 41 | return new DefaultAdvisorAutoProxyCreator(); 42 | } 43 | 44 | /** 45 | * ShiroFilterFactoryBean 处理拦截资源文件问题。 46 | * 注意:单独一个ShiroFilterFactoryBean配置是或报错的,因为在 47 | * 初始化ShiroFilterFactoryBean的时候需要注入:SecurityManager 48 | * 49 | Filter Chain定义说明 50 | 1、一个URL可以配置多个Filter,使用逗号分隔 51 | 2、当设置多个过滤器时,全部验证通过,才视为通过 52 | 3、部分过滤器可指定参数,如perms,roles 53 | * 54 | */ 55 | @Bean 56 | public ShiroFilterFactoryBean shirFilter(SecurityManager securityManager){ 57 | log.info("ShiroConfiguration.shirFilter()"); 58 | ShiroFilterFactoryBean shiroFilterFactoryBean = new ShiroFilterFactoryBean(); 59 | 60 | // 必须设置 SecurityManager 61 | shiroFilterFactoryBean.setSecurityManager(securityManager); 62 | // 如果不设置默认会自动寻找Web工程根目录下的"/login.jsp"页面 63 | shiroFilterFactoryBean.setLoginUrl("/login"); 64 | // 登录成功后要跳转的链接 65 | shiroFilterFactoryBean.setSuccessUrl("/usersPage"); 66 | //未授权界面; 67 | shiroFilterFactoryBean.setUnauthorizedUrl("/403"); 68 | 69 | //自定义拦截器 70 | Map filtersMap = new LinkedHashMap(); 71 | filtersMap.put("myAccessControlFilter", new MyAccessControlFilter()); 72 | shiroFilterFactoryBean.setFilters(filtersMap); 73 | 74 | //拦截器. 75 | Map filterChainDefinitionMap = new LinkedHashMap(); 76 | 77 | //我做的是无状态的,这里的东西实际上是用不到的,仅供参考 78 | //配置退出 过滤器,其中的具体的退出代码Shiro已经替我们实现了 79 | filterChainDefinitionMap.put("/logout", "logout"); 80 | filterChainDefinitionMap.put("/css/**","anon"); 81 | filterChainDefinitionMap.put("/js/**","anon"); 82 | filterChainDefinitionMap.put("/img/**","anon"); 83 | filterChainDefinitionMap.put("/font-awesome/**","anon"); 84 | 85 | 86 | 87 | // filterChainDefinitionMap.put("/users", "anon"); 88 | filterChainDefinitionMap.put("/createPermission", "anon"); 89 | filterChainDefinitionMap.put("/**", "myAccessControlFilter"); 90 | // filterChainDefinitionMap.put("/**", "authc"); 91 | 92 | //:这是一个坑呢,一不小心代码就不好使了; 93 | // 94 | //自定义加载权限资源关系 95 | // List resourcesList = resourcesService.queryAll(); 96 | // for(Resources resources:resourcesList){ 97 | // 98 | // if (StringUtil.isNotEmpty(resources.getResurl())) { 99 | // String permission = "perms[" + resources.getResurl()+ "]"; 100 | // filterChainDefinitionMap.put(resources.getResurl(),permission); 101 | // } 102 | // } 103 | 104 | shiroFilterFactoryBean.setFilterChainDefinitionMap(filterChainDefinitionMap); 105 | return shiroFilterFactoryBean; 106 | } 107 | 108 | @Bean 109 | public SecurityManager securityManager(){ 110 | DefaultWebSecurityManager securityManager=new DefaultWebSecurityManager(); 111 | //设置realm. 112 | // securityManager.setAuthenticator(modularRealmAuthenticator()); 113 | securityManager.setAuthenticator(customizedModularRealmAuthenticator()); 114 | 115 | List realms=new ArrayList<>(); 116 | realms.add(myShiroRealm()); 117 | realms.add(myShiroRealm2()); 118 | securityManager.setRealms(realms); 119 | return securityManager; 120 | } 121 | 122 | @Bean 123 | public MyShiroRealm myShiroRealm(){ 124 | MyShiroRealm myShiroRealm = new MyShiroRealm(); 125 | //我自己实现的加密判断,这里被备注起来,仅供参考 126 | // myShiroRealm.setCredentialsMatcher(hashedCredentialsMatcher()); 127 | return myShiroRealm; 128 | } 129 | 130 | @Bean 131 | public MyShiroRealm2 myShiroRealm2(){ 132 | MyShiroRealm2 myShiroRealm = new MyShiroRealm2(); 133 | return myShiroRealm; 134 | } 135 | 136 | 137 | /** 138 | * (这里我是用自己定义的加密方式,没用到这块,需要的可以释放出来,注意上面的加载) 139 | * 凭证匹配器 140 | * (由于我们的密码校验交给Shiro的SimpleAuthenticationInfo进行处理了 141 | * 所以我们需要修改下doGetAuthenticationInfo中的代码; 142 | * ) 143 | * @return 144 | */ 145 | @Bean 146 | public HashedCredentialsMatcher hashedCredentialsMatcher(){ 147 | HashedCredentialsMatcher hashedCredentialsMatcher = new HashedCredentialsMatcher(); 148 | 149 | //散列算法:这里使用MD5算法; 150 | hashedCredentialsMatcher.setHashAlgorithmName("md5"); 151 | //散列的次数,比如散列两次,相当于 md5(md5("")); 152 | hashedCredentialsMatcher.setHashIterations(1); 153 | 154 | return hashedCredentialsMatcher; 155 | } 156 | 157 | 158 | /** 159 | * 开启shiro aop注解支持. 160 | * 使用代理方式;所以需要开启代码支持; 161 | * @param securityManager 162 | * @return 163 | */ 164 | @Bean 165 | public AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor(SecurityManager securityManager){ 166 | AuthorizationAttributeSourceAdvisor authorizationAttributeSourceAdvisor = new AuthorizationAttributeSourceAdvisor(); 167 | authorizationAttributeSourceAdvisor.setSecurityManager(securityManager); 168 | return authorizationAttributeSourceAdvisor; 169 | } 170 | 171 | /** 172 | * 自定义的Realm管理,主要针对多realm 173 | * */ 174 | @Bean 175 | public MyModularRealmAuthenticator customizedModularRealmAuthenticator(){ 176 | MyModularRealmAuthenticator customizedModularRealmAuthenticator=new MyModularRealmAuthenticator(); 177 | //设置realm判断条件 178 | customizedModularRealmAuthenticator.setAuthenticationStrategy(new AtLeastOneSuccessfulStrategy()); 179 | 180 | return customizedModularRealmAuthenticator; 181 | } 182 | 183 | /** 184 | * 系统自带的Realm管理,主要针对多realm 185 | * */ 186 | @Bean 187 | public ModularRealmAuthenticator modularRealmAuthenticator(){ 188 | ModularRealmAuthenticator modularRealmAuthenticator=new ModularRealmAuthenticator(); 189 | modularRealmAuthenticator.setAuthenticationStrategy(new AtLeastOneSuccessfulStrategy()); 190 | return modularRealmAuthenticator; 191 | } 192 | } 193 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /.idea/shirodemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | --------------------------------------------------------------------------------