├── .gitignore ├── 1511448376524.txt ├── imooc-security.iml ├── pom.xml ├── security-app ├── pom.xml ├── security-app.iml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── earthchen │ │ └── security │ │ └── app │ │ ├── AppSecretException.java │ │ ├── AppSecurityController.java │ │ ├── authentication │ │ ├── ImoocAuthenticationFailureHandler.java │ │ ├── ImoocAuthenticationSuccessHandler.java │ │ └── openid │ │ │ ├── OpenIdAuthenticationFilter.java │ │ │ ├── OpenIdAuthenticationProvider.java │ │ │ ├── OpenIdAuthenticationSecurityConfig.java │ │ │ └── OpenIdAuthenticationToken.java │ │ ├── jwt │ │ └── ImoocJwtTokenEnhancer.java │ │ ├── server │ │ ├── ImoocAuthorizationServerConfig.java │ │ ├── ImoocResourceServerConfig.java │ │ └── TokenStoreConfig.java │ │ ├── social │ │ ├── AppSingUpUtils.java │ │ ├── SpringSocialConfigurerPostProcessor.java │ │ └── impl │ │ │ └── AppSocialConfigurerPostProcessor.java │ │ └── validate │ │ └── code │ │ └── impl │ │ └── RedisValidateCodeRepository.java └── target │ └── maven-archiver │ └── pom.properties ├── security-authorize ├── pom.xml ├── security-authorize.iml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── earthchen │ │ │ └── security │ │ │ └── rbac │ │ │ ├── authentication │ │ │ └── RbacUserDetailsService.java │ │ │ ├── authorize │ │ │ └── RbacAuthorizeConfigProvider.java │ │ │ ├── domain │ │ │ ├── Admin.java │ │ │ ├── Resource.java │ │ │ ├── ResourceType.java │ │ │ ├── Role.java │ │ │ ├── RoleAdmin.java │ │ │ └── RoleResource.java │ │ │ ├── dto │ │ │ ├── AdminCondition.java │ │ │ ├── AdminInfo.java │ │ │ ├── ResourceInfo.java │ │ │ └── RoleInfo.java │ │ │ ├── init │ │ │ ├── AbstractDataInitializer.java │ │ │ ├── AdminDataInitializer.java │ │ │ ├── DataInitializer.java │ │ │ └── SystemDataInitializer.java │ │ │ ├── repository │ │ │ ├── AdminRepository.java │ │ │ ├── ImoocRepository.java │ │ │ ├── ResourceRepository.java │ │ │ ├── RoleAdminRepository.java │ │ │ ├── RoleRepository.java │ │ │ ├── RoleResourceRepository.java │ │ │ ├── spec │ │ │ │ └── AdminSpec.java │ │ │ └── support │ │ │ │ ├── AbstractConditionBuilder.java │ │ │ │ ├── AbstractDomain2InfoConverter.java │ │ │ │ ├── AbstractEventConditionBuilder.java │ │ │ │ ├── Domain2InfoConverter.java │ │ │ │ ├── GenericUtils.java │ │ │ │ ├── ImoocImplicitNamingStrategy.java │ │ │ │ ├── ImoocSpecification.java │ │ │ │ ├── QueryResultConverter.java │ │ │ │ └── QueryWraper.java │ │ │ ├── service │ │ │ ├── AdminService.java │ │ │ ├── RbacService.java │ │ │ ├── ResourceService.java │ │ │ ├── RoleService.java │ │ │ └── impl │ │ │ │ ├── AdminServiceImpl.java │ │ │ │ ├── RbacServiceImpl.java │ │ │ │ ├── ResourceServiceImpl.java │ │ │ │ └── RoleServiceImpl.java │ │ │ └── web │ │ │ └── controller │ │ │ ├── AdminController.java │ │ │ ├── ResourceController.java │ │ │ ├── RoleController.java │ │ │ └── support │ │ │ └── SimpleResponse.java │ │ └── resources │ │ └── resources │ │ ├── fonts │ │ ├── FontAwesome.otf │ │ ├── fontawesome-webfont.eot │ │ ├── fontawesome-webfont.svg │ │ ├── fontawesome-webfont.ttf │ │ ├── fontawesome-webfont.woff │ │ ├── fontawesome-webfont.woff2 │ │ ├── glyphicons-halflings-regular.eot │ │ ├── glyphicons-halflings-regular.svg │ │ ├── glyphicons-halflings-regular.ttf │ │ ├── glyphicons-halflings-regular.woff │ │ ├── glyphicons-halflings-regular.woff2 │ │ ├── ionicons.eot │ │ ├── ionicons.svg │ │ ├── ionicons.ttf │ │ └── ionicons.woff │ │ ├── manage.html │ │ ├── scripts │ │ ├── app.js │ │ ├── commons │ │ │ ├── admin.js │ │ │ └── common.js │ │ ├── framework │ │ │ ├── angular-animate.min.js │ │ │ ├── angular-cookies.min.js │ │ │ ├── angular-deckgrid.js │ │ │ ├── angular-locale_zh-cn.js │ │ │ ├── angular-resource.min.js │ │ │ ├── angular-sanitize.min.js │ │ │ ├── angular-touch.min.js │ │ │ ├── angular-tree-control.js │ │ │ ├── angular-ui-router.min.js │ │ │ ├── angular.min.js │ │ │ ├── canvas-to-blob.min.js │ │ │ ├── city-picker.min.js │ │ │ ├── iscroll-infinite.js │ │ │ ├── iscroll-lite.js │ │ │ ├── iscroll-probe.js │ │ │ ├── iscroll-zoom.js │ │ │ ├── iscroll.js │ │ │ ├── jquery-2.1.4.js │ │ │ ├── jquery-weui.js │ │ │ ├── jquery-weui.min.js │ │ │ ├── jquery.blueimp-gallery.min.js │ │ │ ├── jquery.min.js │ │ │ ├── jquery.slimscroll.min.js │ │ │ ├── load-image.all.min.js │ │ │ ├── mbdatepicker.js │ │ │ ├── mobiscroll.custom-2.17.2.min.js │ │ │ ├── moment.min.js │ │ │ ├── ng-infinite-scroll.min.js │ │ │ ├── ng-iscroll.js │ │ │ ├── plugins │ │ │ │ ├── advlist │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── anchor │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── autolink │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── autoresize │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── autosave │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── bbcode │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── charmap │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── code │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── codesample │ │ │ │ │ ├── css │ │ │ │ │ │ └── prism.css │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── colorpicker │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── contextmenu │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── directionality │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── emoticons │ │ │ │ │ ├── img │ │ │ │ │ │ ├── smiley-cool.gif │ │ │ │ │ │ ├── smiley-cry.gif │ │ │ │ │ │ ├── smiley-embarassed.gif │ │ │ │ │ │ ├── smiley-foot-in-mouth.gif │ │ │ │ │ │ ├── smiley-frown.gif │ │ │ │ │ │ ├── smiley-innocent.gif │ │ │ │ │ │ ├── smiley-kiss.gif │ │ │ │ │ │ ├── smiley-laughing.gif │ │ │ │ │ │ ├── smiley-money-mouth.gif │ │ │ │ │ │ ├── smiley-sealed.gif │ │ │ │ │ │ ├── smiley-smile.gif │ │ │ │ │ │ ├── smiley-surprised.gif │ │ │ │ │ │ ├── smiley-tongue-out.gif │ │ │ │ │ │ ├── smiley-undecided.gif │ │ │ │ │ │ ├── smiley-wink.gif │ │ │ │ │ │ └── smiley-yell.gif │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── fullpage │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── fullscreen │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── hr │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── image │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── imagetools │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── importcss │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── insertdatetime │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── layer │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── legacyoutput │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── link │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── lists │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── media │ │ │ │ │ ├── moxieplayer.swf │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── nonbreaking │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── noneditable │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── pagebreak │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── paste │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── preview │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── print │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── save │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── searchreplace │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── spellchecker │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── tabfocus │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── table │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── template │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── textcolor │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── textpattern │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── visualblocks │ │ │ │ │ ├── css │ │ │ │ │ │ └── visualblocks.css │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ ├── visualchars │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ │ └── wordcount │ │ │ │ │ ├── plugin.js │ │ │ │ │ └── plugin.min.js │ │ │ ├── select.js │ │ │ ├── select.min.js │ │ │ ├── simplify.js │ │ │ ├── simplify_dashboard.js │ │ │ ├── skins │ │ │ │ └── lightgray │ │ │ │ │ ├── content.inline.min.css │ │ │ │ │ ├── content.min.css │ │ │ │ │ ├── fonts │ │ │ │ │ ├── tinymce-small.eot │ │ │ │ │ ├── tinymce-small.svg │ │ │ │ │ ├── tinymce-small.ttf │ │ │ │ │ ├── tinymce-small.woff │ │ │ │ │ ├── tinymce.eot │ │ │ │ │ ├── tinymce.svg │ │ │ │ │ ├── tinymce.ttf │ │ │ │ │ └── tinymce.woff │ │ │ │ │ ├── img │ │ │ │ │ ├── anchor.gif │ │ │ │ │ ├── loader.gif │ │ │ │ │ ├── object.gif │ │ │ │ │ └── trans.gif │ │ │ │ │ ├── skin.ie7.min.css │ │ │ │ │ └── skin.min.css │ │ │ ├── swiper-3.3.1.min.js │ │ │ ├── themes │ │ │ │ └── modern │ │ │ │ │ ├── theme.js │ │ │ │ │ └── theme.min.js │ │ │ ├── tinymce.js │ │ │ ├── tinymce.min.js │ │ │ ├── toastr.min.js │ │ │ ├── ui-bootstrap-tpls.min.js │ │ │ ├── ui-bootstrap.min.js │ │ │ └── uploader.min.js │ │ └── platform │ │ │ ├── controller │ │ │ ├── adminController.js │ │ │ ├── resourceController.js │ │ │ ├── roleController.js │ │ │ └── sidebarController.js │ │ │ └── module.js │ │ ├── styles │ │ ├── blueimp-gallery.min.css │ │ ├── bootstrap.min.css │ │ ├── font-awesome.min.css │ │ ├── frozen.css │ │ ├── icons_mobiscroll.eot │ │ ├── icons_mobiscroll.svg │ │ ├── icons_mobiscroll.ttf │ │ ├── icons_mobiscroll.woff │ │ ├── images │ │ │ └── spinner.gif │ │ ├── ionicons.min.css │ │ ├── jquery.fileupload-ui.css │ │ ├── jquery.fileupload.css │ │ ├── main.css │ │ ├── mbdatepicker.css │ │ ├── mobiscroll.custom-2.17.2.min.css │ │ ├── pzx-index.css │ │ ├── select.min.css │ │ ├── simplify.min.css │ │ ├── style.css │ │ ├── swiper-3.3.1.min.css │ │ ├── toastr.min.css │ │ ├── tree-control-attribute.css │ │ └── tree-control.css │ │ └── views │ │ ├── commons │ │ ├── confirm.html │ │ ├── partials │ │ │ ├── content.html │ │ │ ├── offsidebar.html │ │ │ ├── sidebar.html │ │ │ └── top-navbar.html │ │ └── password.html │ │ ├── main.html │ │ └── platform │ │ ├── adminForm.html │ │ ├── adminManage.html │ │ ├── resourceForm.html │ │ ├── resourceManage.html │ │ ├── roleForm.html │ │ └── roleManage.html └── target │ └── classes │ └── resources │ ├── fonts │ ├── FontAwesome.otf │ ├── fontawesome-webfont.eot │ ├── fontawesome-webfont.svg │ ├── fontawesome-webfont.ttf │ ├── fontawesome-webfont.woff │ ├── fontawesome-webfont.woff2 │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ ├── glyphicons-halflings-regular.woff2 │ ├── ionicons.eot │ ├── ionicons.svg │ ├── ionicons.ttf │ └── ionicons.woff │ ├── manage.html │ ├── scripts │ ├── app.js │ ├── commons │ │ ├── admin.js │ │ └── common.js │ ├── framework │ │ ├── angular-animate.min.js │ │ ├── angular-cookies.min.js │ │ ├── angular-deckgrid.js │ │ ├── angular-locale_zh-cn.js │ │ ├── angular-resource.min.js │ │ ├── angular-sanitize.min.js │ │ ├── angular-touch.min.js │ │ ├── angular-tree-control.js │ │ ├── angular-ui-router.min.js │ │ ├── angular.min.js │ │ ├── canvas-to-blob.min.js │ │ ├── city-picker.min.js │ │ ├── iscroll-infinite.js │ │ ├── iscroll-lite.js │ │ ├── iscroll-probe.js │ │ ├── iscroll-zoom.js │ │ ├── iscroll.js │ │ ├── jquery-2.1.4.js │ │ ├── jquery-weui.js │ │ ├── jquery-weui.min.js │ │ ├── jquery.blueimp-gallery.min.js │ │ ├── jquery.min.js │ │ ├── jquery.slimscroll.min.js │ │ ├── load-image.all.min.js │ │ ├── mbdatepicker.js │ │ ├── mobiscroll.custom-2.17.2.min.js │ │ ├── moment.min.js │ │ ├── ng-infinite-scroll.min.js │ │ ├── ng-iscroll.js │ │ ├── plugins │ │ │ ├── advlist │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── anchor │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── autolink │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── autoresize │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── autosave │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── bbcode │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── charmap │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── code │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── codesample │ │ │ │ ├── css │ │ │ │ │ └── prism.css │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── colorpicker │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── contextmenu │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── directionality │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── emoticons │ │ │ │ ├── img │ │ │ │ │ ├── smiley-cool.gif │ │ │ │ │ ├── smiley-cry.gif │ │ │ │ │ ├── smiley-embarassed.gif │ │ │ │ │ ├── smiley-foot-in-mouth.gif │ │ │ │ │ ├── smiley-frown.gif │ │ │ │ │ ├── smiley-innocent.gif │ │ │ │ │ ├── smiley-kiss.gif │ │ │ │ │ ├── smiley-laughing.gif │ │ │ │ │ ├── smiley-money-mouth.gif │ │ │ │ │ ├── smiley-sealed.gif │ │ │ │ │ ├── smiley-smile.gif │ │ │ │ │ ├── smiley-surprised.gif │ │ │ │ │ ├── smiley-tongue-out.gif │ │ │ │ │ ├── smiley-undecided.gif │ │ │ │ │ ├── smiley-wink.gif │ │ │ │ │ └── smiley-yell.gif │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── fullpage │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── fullscreen │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── hr │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── image │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── imagetools │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── importcss │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── insertdatetime │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── layer │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── legacyoutput │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── link │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── lists │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── media │ │ │ │ ├── moxieplayer.swf │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── nonbreaking │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── noneditable │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── pagebreak │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── paste │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── preview │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── print │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── save │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── searchreplace │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── spellchecker │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── tabfocus │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── table │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── template │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── textcolor │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── textpattern │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── visualblocks │ │ │ │ ├── css │ │ │ │ │ └── visualblocks.css │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ ├── visualchars │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ │ └── wordcount │ │ │ │ ├── plugin.js │ │ │ │ └── plugin.min.js │ │ ├── select.js │ │ ├── select.min.js │ │ ├── simplify.js │ │ ├── simplify_dashboard.js │ │ ├── skins │ │ │ └── lightgray │ │ │ │ ├── content.inline.min.css │ │ │ │ ├── content.min.css │ │ │ │ ├── fonts │ │ │ │ ├── tinymce-small.eot │ │ │ │ ├── tinymce-small.svg │ │ │ │ ├── tinymce-small.ttf │ │ │ │ ├── tinymce-small.woff │ │ │ │ ├── tinymce.eot │ │ │ │ ├── tinymce.svg │ │ │ │ ├── tinymce.ttf │ │ │ │ └── tinymce.woff │ │ │ │ ├── img │ │ │ │ ├── anchor.gif │ │ │ │ ├── loader.gif │ │ │ │ ├── object.gif │ │ │ │ └── trans.gif │ │ │ │ ├── skin.ie7.min.css │ │ │ │ └── skin.min.css │ │ ├── swiper-3.3.1.min.js │ │ ├── themes │ │ │ └── modern │ │ │ │ ├── theme.js │ │ │ │ └── theme.min.js │ │ ├── tinymce.js │ │ ├── tinymce.min.js │ │ ├── toastr.min.js │ │ ├── ui-bootstrap-tpls.min.js │ │ ├── ui-bootstrap.min.js │ │ └── uploader.min.js │ └── platform │ │ ├── controller │ │ ├── adminController.js │ │ ├── resourceController.js │ │ ├── roleController.js │ │ └── sidebarController.js │ │ └── module.js │ ├── styles │ ├── blueimp-gallery.min.css │ ├── bootstrap.min.css │ ├── font-awesome.min.css │ ├── frozen.css │ ├── icons_mobiscroll.eot │ ├── icons_mobiscroll.svg │ ├── icons_mobiscroll.ttf │ ├── icons_mobiscroll.woff │ ├── images │ │ └── spinner.gif │ ├── ionicons.min.css │ ├── jquery.fileupload-ui.css │ ├── jquery.fileupload.css │ ├── main.css │ ├── mbdatepicker.css │ ├── mobiscroll.custom-2.17.2.min.css │ ├── pzx-index.css │ ├── select.min.css │ ├── simplify.min.css │ ├── style.css │ ├── swiper-3.3.1.min.css │ ├── toastr.min.css │ ├── tree-control-attribute.css │ └── tree-control.css │ └── views │ ├── commons │ ├── confirm.html │ ├── partials │ │ ├── content.html │ │ ├── offsidebar.html │ │ ├── sidebar.html │ │ └── top-navbar.html │ └── password.html │ ├── main.html │ └── platform │ ├── adminForm.html │ ├── adminManage.html │ ├── resourceForm.html │ ├── resourceManage.html │ ├── roleForm.html │ └── roleManage.html ├── security-browser ├── pom.xml ├── security-browser.iml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── earthchen │ │ │ └── security │ │ │ └── browser │ │ │ ├── BrowserSecurityBeanConfig.java │ │ │ ├── BrowserSecurityConfig.java │ │ │ ├── BrowserSecurityController.java │ │ │ ├── authentication │ │ │ ├── ImoocAuthenticationFailureHandler.java │ │ │ └── ImoocAuthenticationSuccessHandler.java │ │ │ ├── logout │ │ │ └── ImoocLogoutSuccessHandler.java │ │ │ ├── session │ │ │ ├── AbstractSessionStrategy.java │ │ │ ├── ImoocExpiredSessionStrategy.java │ │ │ └── ImoocInvalidSessionStrategy.java │ │ │ └── validate │ │ │ └── code │ │ │ └── impl │ │ │ └── SessionValidateCodeRepository.java │ │ └── resources │ │ └── resources │ │ ├── imooc-banding.html │ │ ├── imooc-logout.html │ │ ├── imooc-signIn.html │ │ ├── imooc-signUp.html │ │ └── session │ │ └── invalid.html └── target │ ├── classes │ └── resources │ │ ├── imooc-banding.html │ │ ├── imooc-logout.html │ │ ├── imooc-signIn.html │ │ ├── imooc-signUp.html │ │ └── session │ │ └── invalid.html │ └── maven-archiver │ └── pom.properties ├── security-core ├── pom.xml ├── security-core.iml ├── src │ └── main │ │ └── java │ │ └── com │ │ └── earthchen │ │ └── security │ │ └── core │ │ ├── SecurityCoreConfig.java │ │ ├── authentication │ │ ├── AuthenticationBeanConfig.java │ │ ├── DefaultSocialUserDetailsService.java │ │ ├── DefaultUserDetailsService.java │ │ ├── FormAuthenticationConfig.java │ │ └── mobile │ │ │ ├── SmsCodeAuthenticationFilter.java │ │ │ ├── SmsCodeAuthenticationProvider.java │ │ │ ├── SmsCodeAuthenticationSecurityConfig.java │ │ │ └── SmsCodeAuthenticationToken.java │ │ ├── authorize │ │ ├── AuthorizeConfigManager.java │ │ ├── AuthorizeConfigProvider.java │ │ ├── ImoocAuthorizeConfigManager.java │ │ └── ImoocAuthorizeConfigProvider.java │ │ ├── properties │ │ ├── BrowserProperties.java │ │ ├── ImageCodeProperties.java │ │ ├── LoginResponseType.java │ │ ├── OAuth2ClientProperties.java │ │ ├── OAuth2Properties.java │ │ ├── QQProperties.java │ │ ├── SecurityConstants.java │ │ ├── SecurityProperties.java │ │ ├── SessionProperties.java │ │ ├── SmsCodeProperties.java │ │ ├── SocialProperties.java │ │ ├── ValidateCodeProperties.java │ │ └── WeixinProperties.java │ │ ├── social │ │ ├── SocialConfig.java │ │ ├── qq │ │ │ ├── api │ │ │ │ ├── QQ.java │ │ │ │ ├── QQImpl.java │ │ │ │ └── QQUserInfo.java │ │ │ ├── config │ │ │ │ └── QQAutoConfig.java │ │ │ └── connet │ │ │ │ ├── QQAdapter.java │ │ │ │ ├── QQConnectionFactory.java │ │ │ │ ├── QQOAuth2Template.java │ │ │ │ └── QQServiceProvider.java │ │ ├── support │ │ │ ├── ImoocSpringSocialConfigurer.java │ │ │ ├── SocialAuthenticationFilterPostProcessor.java │ │ │ └── SocialUserInfo.java │ │ ├── view │ │ │ ├── ImoocConnectView.java │ │ │ └── ImoocConnectionStatusView.java │ │ └── weixin │ │ │ ├── api │ │ │ ├── Weixin.java │ │ │ ├── WeixinImpl.java │ │ │ └── WeixinUserInfo.java │ │ │ ├── config │ │ │ └── WeixinAutoConfiguration.java │ │ │ └── connet │ │ │ ├── WeixinAccessGrant.java │ │ │ ├── WeixinAdapter.java │ │ │ ├── WeixinConnectionFactory.java │ │ │ ├── WeixinOAuth2Template.java │ │ │ └── WeixinServiceProvider.java │ │ ├── support │ │ └── SimpleResponse.java │ │ └── validate │ │ └── code │ │ ├── ValidateCode.java │ │ ├── ValidateCodeBeanConfig.java │ │ ├── ValidateCodeController.java │ │ ├── ValidateCodeException.java │ │ ├── ValidateCodeFilter.java │ │ ├── ValidateCodeGenerator.java │ │ ├── ValidateCodeProcessor.java │ │ ├── ValidateCodeProcessorHolder.java │ │ ├── ValidateCodeRepository.java │ │ ├── ValidateCodeSecurityConfig.java │ │ ├── ValidateCodeType.java │ │ ├── image │ │ ├── ImageCode.java │ │ ├── ImageCodeGenerator.java │ │ └── ImageCodeProcessor.java │ │ ├── impl │ │ └── AbstractValidateCodeProcessor.java │ │ └── sms │ │ ├── DefaultSmsCodeSender.java │ │ ├── SmsCodeGenerator.java │ │ ├── SmsCodeProcessor.java │ │ └── SmsCodeSender.java └── target │ ├── classes │ └── META-INF │ │ └── spring-configuration-metadata.json │ └── maven-archiver │ └── pom.properties ├── security-demo ├── pom.xml ├── security-demo.iml ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── earthchen │ │ │ │ ├── DemoApplication.java │ │ │ │ ├── code │ │ │ │ └── DemoImageCodeGenerator.java │ │ │ │ ├── dto │ │ │ │ ├── FileInfo.java │ │ │ │ ├── User.java │ │ │ │ └── UserQueryCondition.java │ │ │ │ ├── excepetion │ │ │ │ └── UserNotExistException.java │ │ │ │ ├── interceptor │ │ │ │ └── TimeInterceptor.java │ │ │ │ ├── security │ │ │ │ ├── DemoAuthorizeConfigProvider.java │ │ │ │ ├── DemoConnectionSignUp.java │ │ │ │ └── MyUserDetailsService.java │ │ │ │ ├── service │ │ │ │ ├── HelloService.java │ │ │ │ └── impl │ │ │ │ │ └── HelloServiceImpl.java │ │ │ │ ├── validator │ │ │ │ ├── MyConstraintValidator.java │ │ │ │ └── MyValidConstraint.java │ │ │ │ ├── web │ │ │ │ ├── aspect │ │ │ │ │ └── TimeAspect.java │ │ │ │ ├── async │ │ │ │ │ ├── AsyncController.java │ │ │ │ │ ├── DeferredResultHolder.java │ │ │ │ │ ├── MockQueue.java │ │ │ │ │ └── QueueListener.java │ │ │ │ ├── config │ │ │ │ │ ├── Swagger2.java │ │ │ │ │ └── WebConfig.java │ │ │ │ ├── controller │ │ │ │ │ ├── ControllerExceptionHandler.java │ │ │ │ │ ├── FileController.java │ │ │ │ │ └── UserController.java │ │ │ │ └── filter │ │ │ │ │ └── TimeFilter.java │ │ │ │ └── wiremock │ │ │ │ └── MockServer.java │ │ └── resources │ │ │ ├── application.yml │ │ │ ├── mock │ │ │ └── response │ │ │ │ ├── 01.txt │ │ │ │ └── 02.txt │ │ │ └── resources │ │ │ ├── demo-logout.html │ │ │ ├── demo-signIn.html │ │ │ ├── demo-signUp.html │ │ │ ├── demo.html │ │ │ ├── error │ │ │ ├── 403.html │ │ │ ├── 404.html │ │ │ └── 500.html │ │ │ └── index.html │ └── test │ │ └── java │ │ └── com │ │ └── earthchen │ │ └── web │ │ └── controller │ │ └── UserControllerTest.java └── target │ ├── classes │ ├── application.yml │ ├── mock │ │ └── response │ │ │ ├── 01.txt │ │ │ └── 02.txt │ └── resources │ │ ├── demo-logout.html │ │ ├── demo-signIn.html │ │ ├── demo-signUp.html │ │ ├── demo.html │ │ ├── error │ │ ├── 403.html │ │ ├── 404.html │ │ └── 500.html │ │ └── index.html │ ├── maven-archiver │ └── pom.properties │ ├── security-demo.jar.original │ └── surefire-reports │ ├── TEST-com.earthchen.web.controller.UserControllerTest.xml │ └── com.earthchen.web.controller.UserControllerTest.txt ├── sso-client1 ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── earthchen │ │ │ └── sso │ │ │ └── client │ │ │ └── SsoClient1Application.java │ │ └── resources │ │ ├── application.yml │ │ └── static │ │ └── index.html ├── sso-client1.iml └── target │ └── classes │ ├── application.yml │ └── static │ └── index.html ├── sso-client2 ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── earthchen │ │ │ └── sso │ │ │ └── client │ │ │ └── SsoClient2Application.java │ │ └── resources │ │ ├── application.yml │ │ └── static │ │ └── index.html ├── sso-client2.iml └── target │ └── classes │ ├── application.yml │ └── static │ └── index.html ├── sso-demo ├── pom.xml └── sso-demo.iml ├── sso-server ├── pom.xml ├── src │ └── main │ │ ├── java │ │ └── com │ │ │ └── earthchen │ │ │ ├── SsoServerApplication.java │ │ │ └── sso │ │ │ └── server │ │ │ ├── SsoApprovalEndpoint.java │ │ │ ├── SsoAuthorizationServerConfig.java │ │ │ ├── SsoSecurityConfig.java │ │ │ ├── SsoSpelView.java │ │ │ └── SsoUserDetailsService.java │ │ └── resources │ │ └── application.yml ├── sso-server.iml └── target │ └── classes │ └── application.yml └── test ├── pom.xml ├── src └── main │ ├── java │ └── com │ │ └── earthchen │ │ ├── TestApplication.java │ │ ├── TestAuthorizeConfigProvider.java │ │ └── TestUserDetails.java │ └── resources │ ├── application.yml │ └── resources │ ├── index.html │ └── signUp.html ├── target └── classes │ ├── application.yml │ └── resources │ ├── index.html │ └── signUp.html └── test.iml /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.jar 15 | *.war 16 | *.ear 17 | *.zip 18 | *.tar.gz 19 | *.rar 20 | 21 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 22 | hs_err_pid* 23 | 24 | 25 | .idea 26 | __files 27 | mappings -------------------------------------------------------------------------------- /1511448376524.txt: -------------------------------------------------------------------------------- 1 | hello upload -------------------------------------------------------------------------------- /imooc-security.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /security-app/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | imooc-security 7 | com.earthchen 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | security-app 13 | 14 | 15 | 16 | com.earthchen 17 | security-core 18 | ${earthchen.security.version} 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /security-app/src/main/java/com/earthchen/security/app/AppSecretException.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.app; 2 | 3 | public class AppSecretException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = -1629364510827838114L; 9 | 10 | public AppSecretException(String msg){ 11 | super(msg); 12 | } 13 | 14 | } -------------------------------------------------------------------------------- /security-app/src/main/java/com/earthchen/security/app/jwt/ImoocJwtTokenEnhancer.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.app.jwt; 2 | 3 | import org.springframework.security.oauth2.common.DefaultOAuth2AccessToken; 4 | import org.springframework.security.oauth2.common.OAuth2AccessToken; 5 | import org.springframework.security.oauth2.provider.OAuth2Authentication; 6 | import org.springframework.security.oauth2.provider.token.TokenEnhancer; 7 | 8 | import java.util.HashMap; 9 | import java.util.Map; 10 | 11 | /** 12 | * 自定义jwt token内的数据 13 | * jwt token 增强器 14 | */ 15 | public class ImoocJwtTokenEnhancer implements TokenEnhancer { 16 | 17 | /** 18 | * 实现方法 19 | * @param accessToken 20 | * @param authentication 21 | * @return 22 | */ 23 | @Override 24 | public OAuth2AccessToken enhance(OAuth2AccessToken accessToken, OAuth2Authentication authentication) { 25 | Map info = new HashMap<>(); 26 | info.put("company", "earthchen"); 27 | 28 | ((DefaultOAuth2AccessToken) accessToken).setAdditionalInformation(info); 29 | 30 | return accessToken; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /security-app/src/main/java/com/earthchen/security/app/social/impl/AppSocialConfigurerPostProcessor.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.app.social.impl; 2 | 3 | import com.earthchen.security.core.social.support.SocialAuthenticationFilterPostProcessor; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 6 | import org.springframework.social.security.SocialAuthenticationFilter; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * app后处理器 11 | */ 12 | @Component 13 | public class AppSocialConfigurerPostProcessor implements SocialAuthenticationFilterPostProcessor { 14 | 15 | @Autowired 16 | private AuthenticationSuccessHandler imoocAuthenticationSuccessHandler; 17 | 18 | @Override 19 | public void process(SocialAuthenticationFilter socialAuthenticationFilter) { 20 | socialAuthenticationFilter.setAuthenticationSuccessHandler(imoocAuthenticationSuccessHandler); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /security-app/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Fri Dec 15 11:34:01 CST 2017 3 | version=1.0-SNAPSHOT 4 | groupId=com.earthchen 5 | artifactId=security-app 6 | -------------------------------------------------------------------------------- /security-authorize/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | imooc-security 7 | com.earthchen 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | security-authorize 13 | 14 | 15 | 16 | com.earthchen 17 | security-core 18 | ${earthchen.security.version} 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-data-jpa 23 | 24 | 25 | joda-time 26 | joda-time 27 | 28 | 29 | joda-time 30 | joda-time 31 | 2.9.4 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/authentication/RbacUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 9 | import org.springframework.stereotype.Component; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import com.earthchen.security.rbac.domain.Admin; 13 | import com.earthchen.security.rbac.repository.AdminRepository; 14 | 15 | /** 16 | * @author zhailiang 17 | * 18 | */ 19 | @Component 20 | @Transactional 21 | public class RbacUserDetailsService implements UserDetailsService { 22 | 23 | private Logger logger = LoggerFactory.getLogger(getClass()); 24 | 25 | @Autowired 26 | private AdminRepository adminRepository; 27 | 28 | /* 29 | * (non-Javadoc) 30 | * 31 | * @see org.springframework.security.core.userdetails.UserDetailsService# 32 | * loadUserByUsername(java.lang.String) 33 | */ 34 | @Override 35 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 36 | logger.info("表单登录用户名:" + username); 37 | Admin admin = adminRepository.findByUsername(username); 38 | admin.getUrls(); 39 | return admin; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/authorize/RbacAuthorizeConfigProvider.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.earthchen.security.rbac.authorize; 5 | 6 | import org.springframework.core.annotation.Order; 7 | import org.springframework.http.HttpMethod; 8 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 9 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; 10 | import org.springframework.stereotype.Component; 11 | 12 | import com.earthchen.security.core.authorize.AuthorizeConfigProvider; 13 | 14 | /** 15 | * @author zhailiang 16 | */ 17 | @Component 18 | @Order(Integer.MAX_VALUE) 19 | public class RbacAuthorizeConfigProvider implements AuthorizeConfigProvider { 20 | 21 | /* (non-Javadoc) 22 | * @see com.imooc.security.core.authorize.AuthorizeConfigProvider#config(org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry) 23 | */ 24 | @Override 25 | public boolean config(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry config) { 26 | config 27 | .antMatchers(HttpMethod.GET, "/fonts/**").permitAll() 28 | .antMatchers(HttpMethod.GET, 29 | "/**/*.html", 30 | "/admin/me", 31 | "/resource").authenticated() 32 | .anyRequest() 33 | .access("@rbacService.hasPermission(request, authentication)"); 34 | return true; 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/domain/ResourceType.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.domain; 2 | 3 | 4 | /** 5 | * @author zhailiang 6 | * 7 | */ 8 | public enum ResourceType { 9 | 10 | MENU, 11 | 12 | BUTTON 13 | 14 | } 15 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/dto/AdminCondition.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.dto; 2 | 3 | /** 4 | * @author zhailiang 5 | * 6 | */ 7 | public class AdminCondition { 8 | 9 | private String username; 10 | 11 | /** 12 | * @return the username 13 | */ 14 | public String getUsername() { 15 | return username; 16 | } 17 | 18 | /** 19 | * @param username the username to set 20 | */ 21 | public void setUsername(String username) { 22 | this.username = username; 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/dto/AdminInfo.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.dto; 2 | 3 | import org.hibernate.validator.constraints.NotBlank; 4 | 5 | /** 6 | * @author zhailiang 7 | * 8 | */ 9 | public class AdminInfo { 10 | 11 | private Long id; 12 | /** 13 | * 角色id 14 | */ 15 | @NotBlank(message = "角色id不能为空") 16 | private Long roleId; 17 | /** 18 | * 用户名 19 | */ 20 | @NotBlank(message = "用户名不能为空") 21 | private String username; 22 | 23 | /** 24 | * @return the id 25 | */ 26 | public Long getId() { 27 | return id; 28 | } 29 | 30 | /** 31 | * @param id the id to set 32 | */ 33 | public void setId(Long id) { 34 | this.id = id; 35 | } 36 | 37 | /** 38 | * @return the roleId 39 | */ 40 | public Long getRoleId() { 41 | return roleId; 42 | } 43 | 44 | /** 45 | * @param roleId the roleId to set 46 | */ 47 | public void setRoleId(Long roleId) { 48 | this.roleId = roleId; 49 | } 50 | 51 | /** 52 | * @return the username 53 | */ 54 | public String getUsername() { 55 | return username; 56 | } 57 | 58 | /** 59 | * @param username the username to set 60 | */ 61 | public void setUsername(String username) { 62 | this.username = username; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/dto/RoleInfo.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.dto; 2 | 3 | /** 4 | * @author zhailiang 5 | * 6 | */ 7 | public class RoleInfo { 8 | 9 | private Long id; 10 | 11 | private String name; 12 | 13 | /** 14 | * @return the id 15 | */ 16 | public Long getId() { 17 | return id; 18 | } 19 | 20 | /** 21 | * @param id the id to set 22 | */ 23 | public void setId(Long id) { 24 | this.id = id; 25 | } 26 | 27 | /** 28 | * @return the name 29 | */ 30 | public String getName() { 31 | return name; 32 | } 33 | 34 | /** 35 | * @param name the name to set 36 | */ 37 | public void setName(String name) { 38 | this.name = name; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/init/AbstractDataInitializer.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.init; 2 | 3 | import java.io.IOException; 4 | 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | import org.springframework.transaction.annotation.Transactional; 8 | 9 | /** 10 | * 抽象数据初始化器,所有的数据初始化器应该继承此类 11 | * 12 | * @author zhailiang 13 | * 14 | */ 15 | public abstract class AbstractDataInitializer implements DataInitializer { 16 | 17 | protected Logger logger = LoggerFactory.getLogger(getClass()); 18 | 19 | /* (non-Javadoc) 20 | * @see com.idea.core.spi.initializer.DataInitializer#init() 21 | */ 22 | @Override 23 | @Transactional 24 | public void init() throws Exception { 25 | if(isNeedInit()) { 26 | logger.info("使用"+getClass().getSimpleName()+"初始化数据"); 27 | doInit(); 28 | logger.info("使用"+getClass().getSimpleName()+"初始化数据完毕"); 29 | } 30 | } 31 | 32 | /** 33 | * 实际的数据初始化逻辑 34 | * @throws IOException 35 | */ 36 | protected abstract void doInit() throws Exception; 37 | 38 | /** 39 | * 是否执行数据初始化行为 40 | * @return 41 | */ 42 | protected abstract boolean isNeedInit(); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/init/DataInitializer.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.init; 2 | 3 | 4 | /** 5 | * 数据初始化器,设计此接口的目的是封装系统数据的初始化行为,开发人员可以向系统中添加此接口的实现,来增加自定义的数据初始化行为. 6 | * 7 | * @author zhailiang 8 | * 9 | */ 10 | public interface DataInitializer { 11 | 12 | /** 13 | * 初始化器的执行顺序,数值越大的初始化器越靠后执行 14 | * 15 | * @return 16 | */ 17 | Integer getIndex(); 18 | 19 | /** 20 | * 初始化数据的方法 21 | * @throws Exception 22 | */ 23 | void init() throws Exception; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/AdminRepository.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository; 3 | 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.earthchen.security.rbac.domain.Admin; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | @Repository 13 | public interface AdminRepository extends ImoocRepository { 14 | 15 | Admin findByUsername(String username); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/ImoocRepository.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository; 3 | 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 6 | import org.springframework.data.repository.NoRepositoryBean; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | @NoRepositoryBean 13 | public interface ImoocRepository extends JpaRepository, JpaSpecificationExecutor { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/ResourceRepository.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository; 3 | 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.earthchen.security.rbac.domain.Resource; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | @Repository 13 | public interface ResourceRepository extends ImoocRepository { 14 | 15 | Resource findByName(String name); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/RoleAdminRepository.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.repository; 2 | 3 | import org.springframework.stereotype.Repository; 4 | 5 | import com.earthchen.security.rbac.domain.RoleAdmin; 6 | 7 | /** 8 | * @author zhailiang 9 | */ 10 | @Repository 11 | public interface RoleAdminRepository extends ImoocRepository { 12 | 13 | } 14 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/RoleRepository.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository; 3 | 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.earthchen.security.rbac.domain.Role; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | @Repository 13 | public interface RoleRepository extends ImoocRepository { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/RoleResourceRepository.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository; 3 | 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.earthchen.security.rbac.domain.RoleResource; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | @Repository 13 | public interface RoleResourceRepository extends ImoocRepository { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/spec/AdminSpec.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.repository.spec; 2 | 3 | import com.earthchen.security.rbac.domain.Admin; 4 | import com.earthchen.security.rbac.dto.AdminCondition; 5 | import com.earthchen.security.rbac.repository.support.ImoocSpecification; 6 | import com.earthchen.security.rbac.repository.support.QueryWraper; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | public class AdminSpec extends ImoocSpecification { 13 | 14 | public AdminSpec(AdminCondition condition) { 15 | super(condition); 16 | } 17 | 18 | @Override 19 | protected void addCondition(QueryWraper queryWraper) { 20 | addLikeCondition(queryWraper, "username"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/support/AbstractDomain2InfoConverter.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.repository.support; 2 | 3 | import org.springframework.beans.BeanUtils; 4 | 5 | 6 | /** 7 | * @author zhailiang 8 | * 9 | */ 10 | public abstract class AbstractDomain2InfoConverter implements Domain2InfoConverter { 11 | 12 | /* (non-Javadoc) 13 | * @see com.idea.amp.core.support.dhtmlx.Domain2InfoConverter#convert(java.lang.Object, java.lang.Class) 14 | */ 15 | @SuppressWarnings("unchecked") 16 | @Override 17 | public I convert(T domain) { 18 | I info = null; 19 | try { 20 | Class clazz = GenericUtils.getGenericClass(getClass(), 1); 21 | info = clazz.newInstance(); 22 | BeanUtils.copyProperties(domain, info); 23 | doConvert(domain, info); 24 | } catch (Exception e) { 25 | e.printStackTrace(); 26 | } 27 | return info; 28 | } 29 | 30 | protected abstract void doConvert(T domain, I info) throws Exception; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/support/Domain2InfoConverter.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository.support; 3 | 4 | import org.springframework.core.convert.converter.Converter; 5 | 6 | /** 7 | * @author zhailiang 8 | * 9 | */ 10 | public interface Domain2InfoConverter extends Converter { 11 | 12 | } 13 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/support/GenericUtils.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository.support; 3 | 4 | import java.lang.reflect.ParameterizedType; 5 | import java.lang.reflect.Type; 6 | 7 | /** 8 | * 泛型工具 9 | * @author zhailiang 10 | * 11 | */ 12 | public class GenericUtils { 13 | 14 | /** 15 | * 获取目标class的第一个泛型参数的类型 16 | * @param clazz 17 | * @return 18 | */ 19 | @SuppressWarnings("rawtypes") 20 | public static Class getGenericClass(Class clazz){ 21 | return getGenericClass(clazz, 0); 22 | } 23 | 24 | /** 25 | * 获取目标class的指定位置的泛型参数的类型 26 | * @param clazz 27 | * @param index 泛型参数的位置,第一个参数为0 28 | * @return 29 | */ 30 | @SuppressWarnings("rawtypes") 31 | public static Class getGenericClass(Class clazz, int index) { 32 | Type t = clazz.getGenericSuperclass(); 33 | if(t instanceof ParameterizedType){ 34 | Type[] params = ((ParameterizedType)t).getActualTypeArguments(); 35 | if(params[index] instanceof ParameterizedType){ 36 | return ((ParameterizedType)params[index]).getRawType().getClass(); 37 | }else{ 38 | return (Class)params[index]; 39 | } 40 | } 41 | throw new RuntimeException("无法获得泛型的类型"); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/repository/support/ImoocImplicitNamingStrategy.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.repository.support; 3 | 4 | import org.hibernate.boot.model.naming.Identifier; 5 | import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl; 6 | import org.hibernate.boot.spi.MetadataBuildingContext; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | public class ImoocImplicitNamingStrategy extends ImplicitNamingStrategyJpaCompliantImpl { 13 | 14 | /** 15 | * 16 | */ 17 | private static final long serialVersionUID = 769122522217805485L; 18 | 19 | @Override 20 | protected Identifier toIdentifier(String stringForm, MetadataBuildingContext buildingContext) { 21 | return super.toIdentifier("imooc_"+stringForm.toLowerCase(), buildingContext); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/service/AdminService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.service; 2 | 3 | import org.springframework.data.domain.Page; 4 | import org.springframework.data.domain.Pageable; 5 | 6 | import com.earthchen.security.rbac.dto.AdminCondition; 7 | import com.earthchen.security.rbac.dto.AdminInfo; 8 | 9 | /** 10 | * 管理员服务 11 | * 12 | * @author zhailiang 13 | * 14 | */ 15 | public interface AdminService { 16 | 17 | /** 18 | * 创建管理员 19 | * @param adminInfo 20 | * @return 21 | */ 22 | AdminInfo create(AdminInfo adminInfo); 23 | /** 24 | * 修改管理员 25 | * @param adminInfo 26 | * @return 27 | */ 28 | AdminInfo update(AdminInfo adminInfo); 29 | /** 30 | * 删除管理员 31 | * @param id 32 | */ 33 | void delete(Long id); 34 | /** 35 | * 获取管理员详细信息 36 | * @param id 37 | * @return 38 | */ 39 | AdminInfo getInfo(Long id); 40 | /** 41 | * 分页查询管理员 42 | * @param condition 43 | * @return 44 | */ 45 | Page query(AdminCondition condition, Pageable pageable); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/service/RbacService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.service; 2 | 3 | import javax.servlet.http.HttpServletRequest; 4 | 5 | import org.springframework.security.core.Authentication; 6 | 7 | /** 8 | * @author zhailiang 9 | * 10 | */ 11 | public interface RbacService { 12 | 13 | boolean hasPermission(HttpServletRequest request, Authentication authentication); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/service/ResourceService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.service; 2 | 3 | import com.earthchen.security.rbac.dto.ResourceInfo; 4 | 5 | /** 6 | * 资源服务 7 | * 8 | * @author zhailiang 9 | * 10 | */ 11 | public interface ResourceService { 12 | 13 | /** 14 | * 获取资源树 15 | * 16 | * @param userId 用户ID 17 | * @date 2015年7月10日下午7:08:26 18 | * @since 1.0.0 19 | */ 20 | ResourceInfo getTree(Long userId); 21 | 22 | /** 23 | * 根据资源ID获取资源信息 24 | * 25 | * @param id 资源ID 26 | * @return ResourceInfo 资源信息 27 | * @date 2015年7月10日下午7:01:48 28 | * @since 1.0.0 29 | */ 30 | ResourceInfo getInfo(Long id); 31 | 32 | /** 33 | * 新增资源 34 | * 35 | * @param info 页面传入的资源信息 36 | * @return ResourceInfo 资源信息 37 | * @date 2015年7月10日下午7:01:51 38 | * @since 1.0.0 39 | */ 40 | ResourceInfo create(ResourceInfo info); 41 | /** 42 | * 更新资源 43 | * 44 | * @param info 页面传入的资源信息 45 | * @return ResourceInfo 资源信息 46 | * @date 2015年7月10日下午7:01:54 47 | * @since 1.0.0 48 | */ 49 | ResourceInfo update(ResourceInfo info); 50 | /** 51 | * 根据指定ID删除资源信息 52 | * 53 | * @param id 资源ID 54 | * @date 2015年7月10日下午7:01:57 55 | * @since 1.0.0 56 | */ 57 | void delete(Long id); 58 | /** 59 | * 上移/下移资源 60 | * @param id 61 | * @param up 62 | */ 63 | Long move(Long id, boolean up); 64 | 65 | } 66 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/service/RoleService.java: -------------------------------------------------------------------------------- 1 | 2 | package com.earthchen.security.rbac.service; 3 | 4 | import java.util.List; 5 | 6 | import com.earthchen.security.rbac.dto.RoleInfo; 7 | 8 | /** 9 | * 角色服务 10 | * 11 | * @author zhailiang 12 | * 13 | */ 14 | public interface RoleService { 15 | 16 | /** 17 | * 创建角色 18 | * @param roleInfo 19 | * @return 20 | */ 21 | RoleInfo create(RoleInfo roleInfo); 22 | /** 23 | * 修改角色 24 | * @param roleInfo 25 | * @return 26 | */ 27 | RoleInfo update(RoleInfo roleInfo); 28 | /** 29 | * 删除角色 30 | * @param id 31 | */ 32 | void delete(Long id); 33 | /** 34 | * 获取角色详细信息 35 | * @param id 36 | * @return 37 | */ 38 | RoleInfo getInfo(Long id); 39 | /** 40 | * 查询所有角色 41 | * @param condition 42 | * @return 43 | */ 44 | List findAll(); 45 | /** 46 | * @param id 47 | * @return 48 | */ 49 | String[] getRoleResources(Long id); 50 | /** 51 | * @param id 52 | * @param ids 53 | */ 54 | void setRoleResources(Long id, String ids); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/service/impl/RbacServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.service.impl; 2 | 3 | import java.util.Set; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | 7 | import org.apache.commons.lang.StringUtils; 8 | import org.springframework.security.core.Authentication; 9 | import org.springframework.stereotype.Component; 10 | import org.springframework.util.AntPathMatcher; 11 | 12 | import com.earthchen.security.rbac.domain.Admin; 13 | import com.earthchen.security.rbac.service.RbacService; 14 | 15 | /** 16 | * @author zhailiang 17 | * 18 | */ 19 | @Component("rbacService") 20 | public class RbacServiceImpl implements RbacService { 21 | 22 | private AntPathMatcher antPathMatcher = new AntPathMatcher(); 23 | 24 | @Override 25 | public boolean hasPermission(HttpServletRequest request, Authentication authentication) { 26 | Object principal = authentication.getPrincipal(); 27 | 28 | boolean hasPermission = false; 29 | 30 | if (principal instanceof Admin) { 31 | //如果用户名是admin,就永远返回true 32 | if (StringUtils.equals(((Admin) principal).getUsername(), "admin")) { 33 | hasPermission = true; 34 | } else { 35 | // 读取用户所拥有权限的所有URL 36 | Set urls = ((Admin) principal).getUrls(); 37 | for (String url : urls) { 38 | if (antPathMatcher.match(url, request.getRequestURI())) { 39 | hasPermission = true; 40 | break; 41 | } 42 | } 43 | } 44 | } 45 | 46 | return hasPermission; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /security-authorize/src/main/java/com/earthchen/security/rbac/web/controller/support/SimpleResponse.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.rbac.web.controller.support; 2 | 3 | /** 4 | * @author zhailiang 5 | * 6 | */ 7 | public class SimpleResponse { 8 | 9 | public SimpleResponse(Object content){ 10 | this.content = content; 11 | } 12 | 13 | private Object content; 14 | 15 | public Object getContent() { 16 | return content; 17 | } 18 | 19 | public void setContent(Object content) { 20 | this.content = content; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/ionicons.eot -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/ionicons.ttf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/fonts/ionicons.woff -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc overview 5 | * @name testApp 6 | * @description 7 | * # testApp 8 | * 9 | * Main module of the application. 10 | */ 11 | //应用主模块 12 | angular.module('adminApp', ['admin']); 13 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/canvas-to-blob.min.js: -------------------------------------------------------------------------------- 1 | !function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,o=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),n=o&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,a=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,i=(o||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,l,u,b,c,d,B,f;if(e=t.match(a),!e)throw new Error("invalid data URI");for(i=e[2]?e[1]:"text/plain"+(e[3]||";charset=US-ASCII"),l=!!e[4],u=t.slice(e[0].length),b=l?atob(u):decodeURIComponent(u),c=new ArrayBuffer(b.length),d=new Uint8Array(c),B=0;B'}),e+=""}),e+=""}var r=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];e.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:n,onclick:function(t){var n=e.dom.getParent(t.target,"a");n&&(e.insertContent(''+n.getAttribute('),this.hide())}},tooltip:"Emoticons"})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/hr/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugin.js 3 | * 4 | * Released under LGPL License. 5 | * Copyright (c) 1999-2015 Ephox Corp. All rights reserved 6 | * 7 | * License: http://www.tinymce.com/license 8 | * Contributing: http://www.tinymce.com/contributing 9 | */ 10 | 11 | /*global tinymce:true */ 12 | 13 | tinymce.PluginManager.add('hr', function(editor) { 14 | editor.addCommand('InsertHorizontalRule', function() { 15 | editor.execCommand('mceInsertContent', false, '
'); 16 | }); 17 | 18 | editor.addButton('hr', { 19 | icon: 'hr', 20 | tooltip: 'Horizontal line', 21 | cmd: 'InsertHorizontalRule' 22 | }); 23 | 24 | editor.addMenuItem('hr', { 25 | icon: 'hr', 26 | text: 'Horizontal line', 27 | cmd: 'InsertHorizontalRule', 28 | context: 'insert' 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/hr/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("hr",function(e){e.addCommand("InsertHorizontalRule",function(){e.execCommand("mceInsertContent",!1,"
")}),e.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),e.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/media/moxieplayer.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/plugins/media/moxieplayer.swf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/nonbreaking/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugin.js 3 | * 4 | * Released under LGPL License. 5 | * Copyright (c) 1999-2015 Ephox Corp. All rights reserved 6 | * 7 | * License: http://www.tinymce.com/license 8 | * Contributing: http://www.tinymce.com/contributing 9 | */ 10 | 11 | /*global tinymce:true */ 12 | 13 | tinymce.PluginManager.add('nonbreaking', function(editor) { 14 | var setting = editor.getParam('nonbreaking_force_tab'); 15 | 16 | editor.addCommand('mceNonBreaking', function() { 17 | editor.insertContent( 18 | (editor.plugins.visualchars && editor.plugins.visualchars.state) ? 19 | ' ' : ' ' 20 | ); 21 | 22 | editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1'); 23 | }); 24 | 25 | editor.addButton('nonbreaking', { 26 | title: 'Nonbreaking space', 27 | cmd: 'mceNonBreaking' 28 | }); 29 | 30 | editor.addMenuItem('nonbreaking', { 31 | text: 'Nonbreaking space', 32 | cmd: 'mceNonBreaking', 33 | context: 'insert' 34 | }); 35 | 36 | if (setting) { 37 | var spaces = +setting > 1 ? +setting : 3; // defaults to 3 spaces if setting is true (or 1) 38 | 39 | editor.on('keydown', function(e) { 40 | if (e.keyCode == 9) { 41 | 42 | if (e.shiftKey) { 43 | return; 44 | } 45 | 46 | e.preventDefault(); 47 | for (var i = 0; i < spaces; i++) { 48 | editor.execCommand('mceNonBreaking'); 49 | } 50 | } 51 | }); 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/nonbreaking/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("nonbreaking",function(e){var t=e.getParam("nonbreaking_force_tab");if(e.addCommand("mceNonBreaking",function(){e.insertContent(e.plugins.visualchars&&e.plugins.visualchars.state?' ':" "),e.dom.setAttrib(e.dom.select("span.mce-nbsp"),"data-mce-bogus","1")}),e.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),e.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"}),t){var n=+t>1?+t:3;e.on("keydown",function(t){if(9==t.keyCode){if(t.shiftKey)return;t.preventDefault();for(var r=0;n>r;r++)e.execCommand("mceNonBreaking")}})}}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/noneditable/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("noneditable",function(e){function t(e){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(e)}}function n(t){function n(t){var n=arguments,r=n[n.length-2];return r>0&&'"'==a.charAt(r-1)?t:''+e.dom.encode("string"==typeof n[1]?n[1]:n[0])+""}var r=o.length,a=t.content,s=tinymce.trim(i);if("raw"!=t.format){for(;r--;)a=a.replace(o[r],n);t.content=a}}var r,i,o,a="contenteditable";r=" "+tinymce.trim(e.getParam("noneditable_editable_class","mceEditable"))+" ",i=" "+tinymce.trim(e.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";var s=t(r),l=t(i);o=e.getParam("noneditable_regexp"),o&&!o.length&&(o=[o]),e.on("PreInit",function(){o&&e.on("BeforeSetContent",n),e.parser.addAttributeFilter("class",function(e){for(var t,n=e.length;n--;)t=e[n],s(t)?t.attr(a,"true"):l(t)&&t.attr(a,"false")}),e.serializer.addAttributeFilter(a,function(e){for(var t,n=e.length;n--;)t=e[n],(s(t)||l(t))&&(o&&t.attr("data-mce-content")?(t.name="#text",t.type=3,t.raw=!0,t.value=t.attr("data-mce-content")):t.attr(a,null))})})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/pagebreak/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("pagebreak",function(e){var t="mce-pagebreak",n=e.getParam("pagebreak_separator",""),r=new RegExp(n.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi"),i='';e.addCommand("mcePageBreak",function(){e.settings.pagebreak_split_block?e.insertContent("

"+i+"

"):e.insertContent(i)}),e.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),e.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),e.on("ResolveName",function(n){"IMG"==n.target.nodeName&&e.dom.hasClass(n.target,t)&&(n.name="pagebreak")}),e.on("click",function(n){n=n.target,"IMG"===n.nodeName&&e.dom.hasClass(n,t)&&e.selection.select(n)}),e.on("BeforeSetContent",function(e){e.content=e.content.replace(r,i)}),e.on("PreInit",function(){e.serializer.addNodeFilter("img",function(t){for(var r,i,o=t.length;o--;)if(r=t[o],i=r.attr("class"),i&&-1!==i.indexOf("mce-pagebreak")){var a=r.parent;if(e.schema.getBlockElements()[a.name]&&e.settings.pagebreak_split_block){a.type=3,a.value=n,a.raw=!0,r.remove();continue}r.type=3,r.value=n,r.raw=!0}})})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/print/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugin.js 3 | * 4 | * Released under LGPL License. 5 | * Copyright (c) 1999-2015 Ephox Corp. All rights reserved 6 | * 7 | * License: http://www.tinymce.com/license 8 | * Contributing: http://www.tinymce.com/contributing 9 | */ 10 | 11 | /*global tinymce:true */ 12 | 13 | tinymce.PluginManager.add('print', function(editor) { 14 | editor.addCommand('mcePrint', function() { 15 | editor.getWin().print(); 16 | }); 17 | 18 | editor.addButton('print', { 19 | title: 'Print', 20 | cmd: 'mcePrint' 21 | }); 22 | 23 | editor.addShortcut('Meta+P', '', 'mcePrint'); 24 | 25 | editor.addMenuItem('print', { 26 | text: 'Print', 27 | cmd: 'mcePrint', 28 | icon: 'print', 29 | shortcut: 'Meta+P', 30 | context: 'file' 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/print/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("print",function(e){e.addCommand("mcePrint",function(){e.getWin().print()}),e.addButton("print",{title:"Print",cmd:"mcePrint"}),e.addShortcut("Meta+P","","mcePrint"),e.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Meta+P",context:"file"})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/save/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("save",function(e){function t(){var t;return t=tinymce.DOM.getParent(e.id,"form"),!e.getParam("save_enablewhendirty",!0)||e.isDirty()?(tinymce.triggerSave(),e.getParam("save_onsavecallback")?(e.execCallback("save_onsavecallback",e),void e.nodeChanged()):void(t?(e.setDirty(!1),t.onsubmit&&!t.onsubmit()||("function"==typeof t.submit?t.submit():n(e.translate("Error: Form submit field collision."))),e.nodeChanged()):n(e.translate("Error: No form element found.")))):void 0}function n(t){e.notificationManager.open({text:t,type:"error"})}function r(){var t=tinymce.trim(e.startContent);return e.getParam("save_oncancelcallback")?void e.execCallback("save_oncancelcallback",e):(e.setContent(t),e.undoManager.clear(),void e.nodeChanged())}function i(){var t=this;e.on("nodeChange dirty",function(){t.disabled(e.getParam("save_enablewhendirty",!0)&&!e.isDirty())})}e.addCommand("mceSave",t),e.addCommand("mceCancel",r),e.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:i}),e.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:i}),e.addShortcut("Meta+S","","mceSave")}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/tabfocus/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("tabfocus",function(e){function t(e){9!==e.keyCode||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()}function n(t){function n(n){function o(e){return"BODY"===e.nodeName||"hidden"!=e.type&&"none"!=e.style.display&&"hidden"!=e.style.visibility&&o(e.parentNode)}function l(e){return/INPUT|TEXTAREA|BUTTON/.test(e.tagName)&&tinymce.get(t.id)&&-1!=e.tabIndex&&o(e)}if(s=r.select(":input:enabled,*[tabindex]:not(iframe)"),i(s,function(t,n){return t.id==e.id?(a=n,!1):void 0}),n>0){for(c=a+1;c=0;c--)if(l(s[c]))return s[c];return null}var a,s,l,c;if(!(9!==t.keyCode||t.ctrlKey||t.altKey||t.metaKey||t.isDefaultPrevented())&&(l=o(e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))),1==l.length&&(l[1]=l[0],l[0]=":prev"),s=t.shiftKey?":prev"==l[0]?n(-1):r.get(l[0]):":next"==l[1]?n(1):r.get(l[1]))){var u=tinymce.get(s.id||s.name);s.id&&u?u.focus():tinymce.util.Delay.setTimeout(function(){tinymce.Env.webkit||window.focus(),s.focus()},10),t.preventDefault()}}var r=tinymce.DOM,i=tinymce.each,o=tinymce.explode;e.on("init",function(){e.inline&&tinymce.DOM.setAttrib(e.getBody(),"tabIndex",null),e.on("keyup",t),tinymce.Env.gecko?e.on("keypress keydown",n):e.on("keydown",n)})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/visualblocks/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("visualblocks",function(e,t){function n(){var t=this;t.active(o),e.on("VisualBlocks",function(){t.active(e.dom.hasClass(e.getBody(),"mce-visualblocks"))})}var r,i,o;window.NodeList&&(e.addCommand("mceVisualBlocks",function(){var n,a=e.dom;r||(r=a.uniqueId(),n=a.create("link",{id:r,rel:"stylesheet",href:t+"/css/visualblocks.css"}),e.getDoc().getElementsByTagName("head")[0].appendChild(n)),e.on("PreviewFormats AfterPreviewFormats",function(t){o&&a.toggleClass(e.getBody(),"mce-visualblocks","afterpreviewformats"==t.type)}),a.toggleClass(e.getBody(),"mce-visualblocks"),o=e.dom.hasClass(e.getBody(),"mce-visualblocks"),i&&i.active(a.hasClass(e.getBody(),"mce-visualblocks")),e.fire("VisualBlocks")}),e.addButton("visualblocks",{title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:n}),e.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:n,selectable:!0,context:"view",prependToContext:!0}),e.on("init",function(){e.settings.visualblocks_default_state&&e.execCommand("mceVisualBlocks",!1,null,{skip_focus:!0})}),e.on("remove",function(){e.dom.removeClass(e.getBody(),"mce-visualblocks")}))}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/visualchars/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("visualchars",function(e){function t(t){function n(e){return''+e+""}function o(){var e,t="";for(e in p)t+=e;return new RegExp("["+t+"]","g")}function a(){var e,t="";for(e in p)t&&(t+=","),t+="span.mce-"+p[e];return t}var s,l,c,u,d,f,p,m,h=e.getBody(),g=e.selection;if(p={"\xa0":"nbsp","\xad":"shy"},r=!r,i.state=r,e.fire("VisualChars",{state:r}),m=o(),t&&(f=g.getBookmark()),r)for(l=[],tinymce.walk(h,function(e){3==e.nodeType&&e.nodeValue&&m.test(e.nodeValue)&&l.push(e)},"childNodes"),c=0;c=0;c--)e.dom.remove(l[c],1);g.moveToBookmark(f)}function n(){var t=this;e.on("VisualChars",function(e){t.active(e.state)})}var r,i=this;e.addCommand("mceVisualChars",t),e.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:n}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:n,selectable:!0,context:"view",prependToContext:!0}),e.on("beforegetcontent",function(e){r&&"raw"!=e.format&&!e.draft&&(r=!0,t(!1))})}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/plugins/wordcount/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("wordcount",function(e){function t(){e.theme.panel.find("#wordcount").text(["Words: {0}",i.getCount()])}var n,r,i=this;n=e.getParam("wordcount_countregex",/[\w\u2019\x27\-\u00C0-\u1FFF]+/g),r=e.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\x27\x22_+=\\\/\-]*/g),e.on("init",function(){var n=e.theme.panel&&e.theme.panel.find("#statusbar")[0];n&&tinymce.util.Delay.setEditorTimeout(e,function(){n.insert({type:"label",name:"wordcount",text:["Words: {0}",i.getCount()],classes:"wordcount",disabled:e.settings.readonly},0),e.on("setcontent beforeaddundo",t),e.on("keyup",function(e){32==e.keyCode&&t()})},0)}),i.getCount=function(){var t=e.getContent({format:"raw"}),i=0;if(t){t=t.replace(/\.\.\./g," "),t=t.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," "),t=t.replace(/(\w+)(&#?[a-z0-9]+;)+(\w+)/i,"$1$3").replace(/&.+?;/g," "),t=t.replace(r,"");var o=t.match(n);o&&(i=o.length)}return i}}); -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.eot -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.ttf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.woff -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce.eot -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce.ttf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/fonts/tinymce.woff -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/anchor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/anchor.gif -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/loader.gif -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/object.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/object.gif -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/trans.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/scripts/framework/skins/lightgray/img/trans.gif -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/styles/icons_mobiscroll.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/styles/icons_mobiscroll.eot -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/styles/icons_mobiscroll.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/styles/icons_mobiscroll.ttf -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/styles/icons_mobiscroll.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/styles/icons_mobiscroll.woff -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/styles/images/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/src/main/resources/resources/styles/images/spinner.gif -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/styles/jquery.fileupload-ui.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload UI Plugin CSS 9.0.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2010, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileupload-buttonbar .btn, 14 | .fileupload-buttonbar .toggle { 15 | margin-bottom: 5px; 16 | } 17 | .progress-animated .progress-bar, 18 | .progress-animated .bar { 19 | background: url("../img/progressbar.gif") !important; 20 | filter: none; 21 | } 22 | .fileupload-process { 23 | float: right; 24 | display: none; 25 | } 26 | .fileupload-processing .fileupload-process, 27 | .files .processing .preview { 28 | display: block; 29 | width: 32px; 30 | height: 32px; 31 | background: url("../img/loading.gif") center no-repeat; 32 | background-size: contain; 33 | } 34 | .files audio, 35 | .files video { 36 | max-width: 300px; 37 | } 38 | 39 | @media (max-width: 767px) { 40 | .fileupload-buttonbar .toggle, 41 | .files .toggle, 42 | .files .btn span { 43 | display: none; 44 | } 45 | .files .name { 46 | width: 80px; 47 | word-wrap: break-word; 48 | } 49 | .files audio, 50 | .files video { 51 | max-width: 80px; 52 | } 53 | .files img, 54 | .files canvas { 55 | max-width: 100%; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/styles/jquery.fileupload.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload Plugin CSS 1.3.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2013, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileinput-button { 14 | position: relative; 15 | overflow: hidden; 16 | } 17 | .fileinput-button input { 18 | position: absolute; 19 | top: 0; 20 | right: 0; 21 | margin: 0; 22 | opacity: 0; 23 | -ms-filter: 'alpha(opacity=0)'; 24 | font-size: 200px; 25 | direction: ltr; 26 | cursor: pointer; 27 | } 28 | 29 | /* Fixes for IE < 8 */ 30 | @media screen\9 { 31 | .fileinput-button input { 32 | filter: alpha(opacity=0); 33 | font-size: 100%; 34 | height: 100%; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/views/commons/confirm.html: -------------------------------------------------------------------------------- 1 | 7 | 10 | 13 | -------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/views/commons/partials/content.html: -------------------------------------------------------------------------------- 1 |
3 | 4 | 5 |
7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 |
15 |
16 |
-------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/views/commons/partials/offsidebar.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 | 16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 | 26 | 27 |
28 |
29 |
-------------------------------------------------------------------------------- /security-authorize/src/main/resources/resources/views/platform/roleForm.html: -------------------------------------------------------------------------------- 1 |
2 |
角色信息
3 |
4 |
5 |
6 |
7 | 8 |
9 | 10 | 11 |
12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 |
-------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/ionicons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/ionicons.eot -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/ionicons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/ionicons.ttf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/fonts/ionicons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/fonts/ionicons.woff -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | /** 4 | * @ngdoc overview 5 | * @name testApp 6 | * @description 7 | * # testApp 8 | * 9 | * Main module of the application. 10 | */ 11 | //应用主模块 12 | angular.module('adminApp', ['admin']); 13 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/canvas-to-blob.min.js: -------------------------------------------------------------------------------- 1 | !function(t){"use strict";var e=t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype,o=t.Blob&&function(){try{return Boolean(new Blob)}catch(t){return!1}}(),n=o&&t.Uint8Array&&function(){try{return 100===new Blob([new Uint8Array(100)]).size}catch(t){return!1}}(),r=t.BlobBuilder||t.WebKitBlobBuilder||t.MozBlobBuilder||t.MSBlobBuilder,a=/^data:((.*?)(;charset=.*?)?)(;base64)?,/,i=(o||r)&&t.atob&&t.ArrayBuffer&&t.Uint8Array&&function(t){var e,i,l,u,b,c,d,B,f;if(e=t.match(a),!e)throw new Error("invalid data URI");for(i=e[2]?e[1]:"text/plain"+(e[3]||";charset=US-ASCII"),l=!!e[4],u=t.slice(e[0].length),b=l?atob(u):decodeURIComponent(u),c=new ArrayBuffer(b.length),d=new Uint8Array(c),B=0;B'}),e+=""}),e+=""}var r=[["cool","cry","embarassed","foot-in-mouth"],["frown","innocent","kiss","laughing"],["money-mouth","sealed","smile","surprised"],["tongue-out","undecided","wink","yell"]];e.addButton("emoticons",{type:"panelbutton",panel:{role:"application",autohide:!0,html:n,onclick:function(t){var n=e.dom.getParent(t.target,"a");n&&(e.insertContent(''+n.getAttribute('),this.hide())}},tooltip:"Emoticons"})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/hr/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugin.js 3 | * 4 | * Released under LGPL License. 5 | * Copyright (c) 1999-2015 Ephox Corp. All rights reserved 6 | * 7 | * License: http://www.tinymce.com/license 8 | * Contributing: http://www.tinymce.com/contributing 9 | */ 10 | 11 | /*global tinymce:true */ 12 | 13 | tinymce.PluginManager.add('hr', function(editor) { 14 | editor.addCommand('InsertHorizontalRule', function() { 15 | editor.execCommand('mceInsertContent', false, '
'); 16 | }); 17 | 18 | editor.addButton('hr', { 19 | icon: 'hr', 20 | tooltip: 'Horizontal line', 21 | cmd: 'InsertHorizontalRule' 22 | }); 23 | 24 | editor.addMenuItem('hr', { 25 | icon: 'hr', 26 | text: 'Horizontal line', 27 | cmd: 'InsertHorizontalRule', 28 | context: 'insert' 29 | }); 30 | }); 31 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/hr/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("hr",function(e){e.addCommand("InsertHorizontalRule",function(){e.execCommand("mceInsertContent",!1,"
")}),e.addButton("hr",{icon:"hr",tooltip:"Horizontal line",cmd:"InsertHorizontalRule"}),e.addMenuItem("hr",{icon:"hr",text:"Horizontal line",cmd:"InsertHorizontalRule",context:"insert"})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/media/moxieplayer.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/plugins/media/moxieplayer.swf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/nonbreaking/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugin.js 3 | * 4 | * Released under LGPL License. 5 | * Copyright (c) 1999-2015 Ephox Corp. All rights reserved 6 | * 7 | * License: http://www.tinymce.com/license 8 | * Contributing: http://www.tinymce.com/contributing 9 | */ 10 | 11 | /*global tinymce:true */ 12 | 13 | tinymce.PluginManager.add('nonbreaking', function(editor) { 14 | var setting = editor.getParam('nonbreaking_force_tab'); 15 | 16 | editor.addCommand('mceNonBreaking', function() { 17 | editor.insertContent( 18 | (editor.plugins.visualchars && editor.plugins.visualchars.state) ? 19 | ' ' : ' ' 20 | ); 21 | 22 | editor.dom.setAttrib(editor.dom.select('span.mce-nbsp'), 'data-mce-bogus', '1'); 23 | }); 24 | 25 | editor.addButton('nonbreaking', { 26 | title: 'Nonbreaking space', 27 | cmd: 'mceNonBreaking' 28 | }); 29 | 30 | editor.addMenuItem('nonbreaking', { 31 | text: 'Nonbreaking space', 32 | cmd: 'mceNonBreaking', 33 | context: 'insert' 34 | }); 35 | 36 | if (setting) { 37 | var spaces = +setting > 1 ? +setting : 3; // defaults to 3 spaces if setting is true (or 1) 38 | 39 | editor.on('keydown', function(e) { 40 | if (e.keyCode == 9) { 41 | 42 | if (e.shiftKey) { 43 | return; 44 | } 45 | 46 | e.preventDefault(); 47 | for (var i = 0; i < spaces; i++) { 48 | editor.execCommand('mceNonBreaking'); 49 | } 50 | } 51 | }); 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/nonbreaking/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("nonbreaking",function(e){var t=e.getParam("nonbreaking_force_tab");if(e.addCommand("mceNonBreaking",function(){e.insertContent(e.plugins.visualchars&&e.plugins.visualchars.state?' ':" "),e.dom.setAttrib(e.dom.select("span.mce-nbsp"),"data-mce-bogus","1")}),e.addButton("nonbreaking",{title:"Nonbreaking space",cmd:"mceNonBreaking"}),e.addMenuItem("nonbreaking",{text:"Nonbreaking space",cmd:"mceNonBreaking",context:"insert"}),t){var n=+t>1?+t:3;e.on("keydown",function(t){if(9==t.keyCode){if(t.shiftKey)return;t.preventDefault();for(var r=0;n>r;r++)e.execCommand("mceNonBreaking")}})}}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/noneditable/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("noneditable",function(e){function t(e){return function(t){return-1!==(" "+t.attr("class")+" ").indexOf(e)}}function n(t){function n(t){var n=arguments,r=n[n.length-2];return r>0&&'"'==a.charAt(r-1)?t:''+e.dom.encode("string"==typeof n[1]?n[1]:n[0])+""}var r=o.length,a=t.content,s=tinymce.trim(i);if("raw"!=t.format){for(;r--;)a=a.replace(o[r],n);t.content=a}}var r,i,o,a="contenteditable";r=" "+tinymce.trim(e.getParam("noneditable_editable_class","mceEditable"))+" ",i=" "+tinymce.trim(e.getParam("noneditable_noneditable_class","mceNonEditable"))+" ";var s=t(r),l=t(i);o=e.getParam("noneditable_regexp"),o&&!o.length&&(o=[o]),e.on("PreInit",function(){o&&e.on("BeforeSetContent",n),e.parser.addAttributeFilter("class",function(e){for(var t,n=e.length;n--;)t=e[n],s(t)?t.attr(a,"true"):l(t)&&t.attr(a,"false")}),e.serializer.addAttributeFilter(a,function(e){for(var t,n=e.length;n--;)t=e[n],(s(t)||l(t))&&(o&&t.attr("data-mce-content")?(t.name="#text",t.type=3,t.raw=!0,t.value=t.attr("data-mce-content")):t.attr(a,null))})})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/pagebreak/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("pagebreak",function(e){var t="mce-pagebreak",n=e.getParam("pagebreak_separator",""),r=new RegExp(n.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(e){return"\\"+e}),"gi"),i='';e.addCommand("mcePageBreak",function(){e.settings.pagebreak_split_block?e.insertContent("

"+i+"

"):e.insertContent(i)}),e.addButton("pagebreak",{title:"Page break",cmd:"mcePageBreak"}),e.addMenuItem("pagebreak",{text:"Page break",icon:"pagebreak",cmd:"mcePageBreak",context:"insert"}),e.on("ResolveName",function(n){"IMG"==n.target.nodeName&&e.dom.hasClass(n.target,t)&&(n.name="pagebreak")}),e.on("click",function(n){n=n.target,"IMG"===n.nodeName&&e.dom.hasClass(n,t)&&e.selection.select(n)}),e.on("BeforeSetContent",function(e){e.content=e.content.replace(r,i)}),e.on("PreInit",function(){e.serializer.addNodeFilter("img",function(t){for(var r,i,o=t.length;o--;)if(r=t[o],i=r.attr("class"),i&&-1!==i.indexOf("mce-pagebreak")){var a=r.parent;if(e.schema.getBlockElements()[a.name]&&e.settings.pagebreak_split_block){a.type=3,a.value=n,a.raw=!0,r.remove();continue}r.type=3,r.value=n,r.raw=!0}})})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/print/plugin.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugin.js 3 | * 4 | * Released under LGPL License. 5 | * Copyright (c) 1999-2015 Ephox Corp. All rights reserved 6 | * 7 | * License: http://www.tinymce.com/license 8 | * Contributing: http://www.tinymce.com/contributing 9 | */ 10 | 11 | /*global tinymce:true */ 12 | 13 | tinymce.PluginManager.add('print', function(editor) { 14 | editor.addCommand('mcePrint', function() { 15 | editor.getWin().print(); 16 | }); 17 | 18 | editor.addButton('print', { 19 | title: 'Print', 20 | cmd: 'mcePrint' 21 | }); 22 | 23 | editor.addShortcut('Meta+P', '', 'mcePrint'); 24 | 25 | editor.addMenuItem('print', { 26 | text: 'Print', 27 | cmd: 'mcePrint', 28 | icon: 'print', 29 | shortcut: 'Meta+P', 30 | context: 'file' 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/print/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("print",function(e){e.addCommand("mcePrint",function(){e.getWin().print()}),e.addButton("print",{title:"Print",cmd:"mcePrint"}),e.addShortcut("Meta+P","","mcePrint"),e.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print",shortcut:"Meta+P",context:"file"})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/save/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("save",function(e){function t(){var t;return t=tinymce.DOM.getParent(e.id,"form"),!e.getParam("save_enablewhendirty",!0)||e.isDirty()?(tinymce.triggerSave(),e.getParam("save_onsavecallback")?(e.execCallback("save_onsavecallback",e),void e.nodeChanged()):void(t?(e.setDirty(!1),t.onsubmit&&!t.onsubmit()||("function"==typeof t.submit?t.submit():n(e.translate("Error: Form submit field collision."))),e.nodeChanged()):n(e.translate("Error: No form element found.")))):void 0}function n(t){e.notificationManager.open({text:t,type:"error"})}function r(){var t=tinymce.trim(e.startContent);return e.getParam("save_oncancelcallback")?void e.execCallback("save_oncancelcallback",e):(e.setContent(t),e.undoManager.clear(),void e.nodeChanged())}function i(){var t=this;e.on("nodeChange dirty",function(){t.disabled(e.getParam("save_enablewhendirty",!0)&&!e.isDirty())})}e.addCommand("mceSave",t),e.addCommand("mceCancel",r),e.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:i}),e.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:i}),e.addShortcut("Meta+S","","mceSave")}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/tabfocus/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("tabfocus",function(e){function t(e){9!==e.keyCode||e.ctrlKey||e.altKey||e.metaKey||e.preventDefault()}function n(t){function n(n){function o(e){return"BODY"===e.nodeName||"hidden"!=e.type&&"none"!=e.style.display&&"hidden"!=e.style.visibility&&o(e.parentNode)}function l(e){return/INPUT|TEXTAREA|BUTTON/.test(e.tagName)&&tinymce.get(t.id)&&-1!=e.tabIndex&&o(e)}if(s=r.select(":input:enabled,*[tabindex]:not(iframe)"),i(s,function(t,n){return t.id==e.id?(a=n,!1):void 0}),n>0){for(c=a+1;c=0;c--)if(l(s[c]))return s[c];return null}var a,s,l,c;if(!(9!==t.keyCode||t.ctrlKey||t.altKey||t.metaKey||t.isDefaultPrevented())&&(l=o(e.getParam("tab_focus",e.getParam("tabfocus_elements",":prev,:next"))),1==l.length&&(l[1]=l[0],l[0]=":prev"),s=t.shiftKey?":prev"==l[0]?n(-1):r.get(l[0]):":next"==l[1]?n(1):r.get(l[1]))){var u=tinymce.get(s.id||s.name);s.id&&u?u.focus():tinymce.util.Delay.setTimeout(function(){tinymce.Env.webkit||window.focus(),s.focus()},10),t.preventDefault()}}var r=tinymce.DOM,i=tinymce.each,o=tinymce.explode;e.on("init",function(){e.inline&&tinymce.DOM.setAttrib(e.getBody(),"tabIndex",null),e.on("keyup",t),tinymce.Env.gecko?e.on("keypress keydown",n):e.on("keydown",n)})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/visualblocks/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("visualblocks",function(e,t){function n(){var t=this;t.active(o),e.on("VisualBlocks",function(){t.active(e.dom.hasClass(e.getBody(),"mce-visualblocks"))})}var r,i,o;window.NodeList&&(e.addCommand("mceVisualBlocks",function(){var n,a=e.dom;r||(r=a.uniqueId(),n=a.create("link",{id:r,rel:"stylesheet",href:t+"/css/visualblocks.css"}),e.getDoc().getElementsByTagName("head")[0].appendChild(n)),e.on("PreviewFormats AfterPreviewFormats",function(t){o&&a.toggleClass(e.getBody(),"mce-visualblocks","afterpreviewformats"==t.type)}),a.toggleClass(e.getBody(),"mce-visualblocks"),o=e.dom.hasClass(e.getBody(),"mce-visualblocks"),i&&i.active(a.hasClass(e.getBody(),"mce-visualblocks")),e.fire("VisualBlocks")}),e.addButton("visualblocks",{title:"Show blocks",cmd:"mceVisualBlocks",onPostRender:n}),e.addMenuItem("visualblocks",{text:"Show blocks",cmd:"mceVisualBlocks",onPostRender:n,selectable:!0,context:"view",prependToContext:!0}),e.on("init",function(){e.settings.visualblocks_default_state&&e.execCommand("mceVisualBlocks",!1,null,{skip_focus:!0})}),e.on("remove",function(){e.dom.removeClass(e.getBody(),"mce-visualblocks")}))}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/visualchars/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("visualchars",function(e){function t(t){function n(e){return''+e+""}function o(){var e,t="";for(e in p)t+=e;return new RegExp("["+t+"]","g")}function a(){var e,t="";for(e in p)t&&(t+=","),t+="span.mce-"+p[e];return t}var s,l,c,u,d,f,p,m,h=e.getBody(),g=e.selection;if(p={"\xa0":"nbsp","\xad":"shy"},r=!r,i.state=r,e.fire("VisualChars",{state:r}),m=o(),t&&(f=g.getBookmark()),r)for(l=[],tinymce.walk(h,function(e){3==e.nodeType&&e.nodeValue&&m.test(e.nodeValue)&&l.push(e)},"childNodes"),c=0;c=0;c--)e.dom.remove(l[c],1);g.moveToBookmark(f)}function n(){var t=this;e.on("VisualChars",function(e){t.active(e.state)})}var r,i=this;e.addCommand("mceVisualChars",t),e.addButton("visualchars",{title:"Show invisible characters",cmd:"mceVisualChars",onPostRender:n}),e.addMenuItem("visualchars",{text:"Show invisible characters",cmd:"mceVisualChars",onPostRender:n,selectable:!0,context:"view",prependToContext:!0}),e.on("beforegetcontent",function(e){r&&"raw"!=e.format&&!e.draft&&(r=!0,t(!1))})}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/plugins/wordcount/plugin.min.js: -------------------------------------------------------------------------------- 1 | tinymce.PluginManager.add("wordcount",function(e){function t(){e.theme.panel.find("#wordcount").text(["Words: {0}",i.getCount()])}var n,r,i=this;n=e.getParam("wordcount_countregex",/[\w\u2019\x27\-\u00C0-\u1FFF]+/g),r=e.getParam("wordcount_cleanregex",/[0-9.(),;:!?%#$?\x27\x22_+=\\\/\-]*/g),e.on("init",function(){var n=e.theme.panel&&e.theme.panel.find("#statusbar")[0];n&&tinymce.util.Delay.setEditorTimeout(e,function(){n.insert({type:"label",name:"wordcount",text:["Words: {0}",i.getCount()],classes:"wordcount",disabled:e.settings.readonly},0),e.on("setcontent beforeaddundo",t),e.on("keyup",function(e){32==e.keyCode&&t()})},0)}),i.getCount=function(){var t=e.getContent({format:"raw"}),i=0;if(t){t=t.replace(/\.\.\./g," "),t=t.replace(/<.[^<>]*?>/g," ").replace(/ | /gi," "),t=t.replace(/(\w+)(&#?[a-z0-9]+;)+(\w+)/i,"$1$3").replace(/&.+?;/g," "),t=t.replace(r,"");var o=t.match(n);o&&(i=o.length)}return i}}); -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.eot -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.ttf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce-small.woff -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce.eot -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce.ttf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/fonts/tinymce.woff -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/anchor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/anchor.gif -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/loader.gif -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/object.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/object.gif -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/trans.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/scripts/framework/skins/lightgray/img/trans.gif -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/styles/icons_mobiscroll.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/styles/icons_mobiscroll.eot -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/styles/icons_mobiscroll.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/styles/icons_mobiscroll.ttf -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/styles/icons_mobiscroll.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/styles/icons_mobiscroll.woff -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/styles/images/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-authorize/target/classes/resources/styles/images/spinner.gif -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/styles/jquery.fileupload-ui.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload UI Plugin CSS 9.0.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2010, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileupload-buttonbar .btn, 14 | .fileupload-buttonbar .toggle { 15 | margin-bottom: 5px; 16 | } 17 | .progress-animated .progress-bar, 18 | .progress-animated .bar { 19 | background: url("../img/progressbar.gif") !important; 20 | filter: none; 21 | } 22 | .fileupload-process { 23 | float: right; 24 | display: none; 25 | } 26 | .fileupload-processing .fileupload-process, 27 | .files .processing .preview { 28 | display: block; 29 | width: 32px; 30 | height: 32px; 31 | background: url("../img/loading.gif") center no-repeat; 32 | background-size: contain; 33 | } 34 | .files audio, 35 | .files video { 36 | max-width: 300px; 37 | } 38 | 39 | @media (max-width: 767px) { 40 | .fileupload-buttonbar .toggle, 41 | .files .toggle, 42 | .files .btn span { 43 | display: none; 44 | } 45 | .files .name { 46 | width: 80px; 47 | word-wrap: break-word; 48 | } 49 | .files audio, 50 | .files video { 51 | max-width: 80px; 52 | } 53 | .files img, 54 | .files canvas { 55 | max-width: 100%; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/styles/jquery.fileupload.css: -------------------------------------------------------------------------------- 1 | @charset "UTF-8"; 2 | /* 3 | * jQuery File Upload Plugin CSS 1.3.0 4 | * https://github.com/blueimp/jQuery-File-Upload 5 | * 6 | * Copyright 2013, Sebastian Tschan 7 | * https://blueimp.net 8 | * 9 | * Licensed under the MIT license: 10 | * http://www.opensource.org/licenses/MIT 11 | */ 12 | 13 | .fileinput-button { 14 | position: relative; 15 | overflow: hidden; 16 | } 17 | .fileinput-button input { 18 | position: absolute; 19 | top: 0; 20 | right: 0; 21 | margin: 0; 22 | opacity: 0; 23 | -ms-filter: 'alpha(opacity=0)'; 24 | font-size: 200px; 25 | direction: ltr; 26 | cursor: pointer; 27 | } 28 | 29 | /* Fixes for IE < 8 */ 30 | @media screen\9 { 31 | .fileinput-button input { 32 | filter: alpha(opacity=0); 33 | font-size: 100%; 34 | height: 100%; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/views/commons/confirm.html: -------------------------------------------------------------------------------- 1 | 7 | 10 | 13 | -------------------------------------------------------------------------------- /security-authorize/target/classes/resources/views/commons/partials/content.html: -------------------------------------------------------------------------------- 1 |
3 | 4 | 5 |
7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 |
15 |
16 |
-------------------------------------------------------------------------------- /security-authorize/target/classes/resources/views/commons/partials/offsidebar.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | 5 |
6 | 16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 | 26 | 27 |
28 |
29 |
-------------------------------------------------------------------------------- /security-authorize/target/classes/resources/views/platform/roleForm.html: -------------------------------------------------------------------------------- 1 |
2 |
角色信息
3 |
4 |
5 |
6 |
7 | 8 |
9 | 10 | 11 |
12 |
13 |
14 | 15 |
16 |
17 |
18 |
19 |
-------------------------------------------------------------------------------- /security-browser/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | imooc-security 7 | com.earthchen 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | security-browser 13 | 14 | 15 | 16 | com.earthchen 17 | security-core 18 | ${earthchen.security.version} 19 | 20 | 21 | 22 | org.springframework.session 23 | spring-session 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /security-browser/src/main/java/com/earthchen/security/browser/session/ImoocExpiredSessionStrategy.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.browser.session; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | 7 | import org.springframework.security.web.session.SessionInformationExpiredEvent; 8 | import org.springframework.security.web.session.SessionInformationExpiredStrategy; 9 | 10 | 11 | /** 12 | * session超时事件处理类 13 | */ 14 | public class ImoocExpiredSessionStrategy extends AbstractSessionStrategy 15 | implements SessionInformationExpiredStrategy { 16 | 17 | public ImoocExpiredSessionStrategy(String invalidSessionUrl) { 18 | super(invalidSessionUrl); 19 | } 20 | 21 | /* (non-Javadoc) 22 | * @see org.springframework.security.web.session.SessionInformationExpiredStrategy#onExpiredSessionDetected(org.springframework.security.web.session.SessionInformationExpiredEvent) 23 | */ 24 | @Override 25 | public void onExpiredSessionDetected(SessionInformationExpiredEvent event) throws IOException, ServletException { 26 | onSessionInvalid(event.getRequest(), event.getResponse()); 27 | } 28 | 29 | /* (non-Javadoc) 30 | * @see com.imooc.security.browser.session.AbstractSessionStrategy#isConcurrency() 31 | */ 32 | @Override 33 | protected boolean isConcurrency() { 34 | return true; 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /security-browser/src/main/java/com/earthchen/security/browser/session/ImoocInvalidSessionStrategy.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.browser.session; 2 | 3 | import java.io.IOException; 4 | 5 | import javax.servlet.ServletException; 6 | import javax.servlet.http.HttpServletRequest; 7 | import javax.servlet.http.HttpServletResponse; 8 | 9 | import org.springframework.security.web.session.InvalidSessionStrategy; 10 | 11 | 12 | public class ImoocInvalidSessionStrategy extends AbstractSessionStrategy 13 | implements InvalidSessionStrategy { 14 | 15 | public ImoocInvalidSessionStrategy(String invalidSessionUrl) { 16 | super(invalidSessionUrl); 17 | } 18 | 19 | @Override 20 | public void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response) 21 | throws IOException, ServletException { 22 | onSessionInvalid(request, response); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /security-browser/src/main/resources/resources/imooc-banding.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

标准绑定页面

9 |
10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /security-browser/src/main/resources/resources/imooc-logout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 退出 6 | 7 | 8 |

退出成功

9 | 10 | 11 | -------------------------------------------------------------------------------- /security-browser/src/main/resources/resources/imooc-signUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

标准注册页面

9 |

这是系统注册页面,请配置earthchen.security.browser.signUpUrl属性来设置自己的注册页

10 | 11 | -------------------------------------------------------------------------------- /security-browser/src/main/resources/resources/session/invalid.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Session失效 6 | 7 | 8 |

session失效页面

9 | 10 | -------------------------------------------------------------------------------- /security-browser/target/classes/resources/imooc-banding.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

标准绑定页面

9 |
10 | 11 |
12 | 13 | -------------------------------------------------------------------------------- /security-browser/target/classes/resources/imooc-logout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 退出 6 | 7 | 8 |

退出成功

9 | 10 | 11 | -------------------------------------------------------------------------------- /security-browser/target/classes/resources/imooc-signUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

标准注册页面

9 |

这是系统注册页面,请配置earthchen.security.browser.signUpUrl属性来设置自己的注册页

10 | 11 | -------------------------------------------------------------------------------- /security-browser/target/classes/resources/session/invalid.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Session失效 6 | 7 | 8 |

session失效页面

9 | 10 | -------------------------------------------------------------------------------- /security-browser/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Fri Dec 15 11:34:01 CST 2017 3 | version=1.0-SNAPSHOT 4 | groupId=com.earthchen 5 | artifactId=security-browser 6 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/SecurityCoreConfig.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core; 2 | 3 | 4 | import com.earthchen.security.core.properties.SecurityProperties; 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.Configuration; 8 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 9 | import org.springframework.security.crypto.password.PasswordEncoder; 10 | 11 | @Configuration 12 | @EnableConfigurationProperties(SecurityProperties.class) 13 | public class SecurityCoreConfig { 14 | 15 | // /** 16 | // * 设置加密解密算法 17 | // * 18 | // * @return 19 | // */ 20 | // @Bean 21 | // public PasswordEncoder passwordEncoder() { 22 | // return new BCryptPasswordEncoder(); 23 | // } 24 | } 25 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/authentication/DefaultSocialUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 6 | import org.springframework.social.security.SocialUserDetails; 7 | import org.springframework.social.security.SocialUserDetailsService; 8 | 9 | /** 10 | * 默认的SocialUserDetailsService实现 11 | * 12 | * 不做任何处理,只在控制台打印一句日志,然后抛出异常,提醒业务系统自己配置SocialUserDetailsService。 13 | * 14 | * 15 | */ 16 | public class DefaultSocialUserDetailsService implements SocialUserDetailsService { 17 | 18 | private Logger logger = LoggerFactory.getLogger(getClass()); 19 | 20 | @Override 21 | public SocialUserDetails loadUserByUserId(String userId) throws UsernameNotFoundException { 22 | logger.warn("请配置 SocialUserDetailsService 接口的实现."); 23 | throw new UsernameNotFoundException(userId); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/authentication/DefaultUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.authentication; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import org.springframework.security.core.userdetails.UserDetails; 6 | import org.springframework.security.core.userdetails.UserDetailsService; 7 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 8 | 9 | /** 10 | * 11 | * 默认的 UserDetailsService 实现 12 | * 13 | * 不做任何处理,只在控制台打印一句日志,然后抛出异常,提醒业务系统自己配置 UserDetailsService。 14 | * 15 | * 16 | */ 17 | public class DefaultUserDetailsService implements UserDetailsService { 18 | 19 | private Logger logger = LoggerFactory.getLogger(getClass()); 20 | 21 | /* 22 | * (non-Javadoc) 23 | * 24 | * @see org.springframework.security.core.userdetails.UserDetailsService# 25 | * loadUserByUsername(java.lang.String) 26 | */ 27 | @Override 28 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 29 | logger.warn("请配置 UserDetailsService 接口的实现."); 30 | throw new UsernameNotFoundException(username); 31 | } 32 | 33 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/authentication/FormAuthenticationConfig.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.authentication; 2 | 3 | import com.earthchen.security.core.properties.SecurityConstants; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; 7 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; 8 | import org.springframework.security.web.authentication.AuthenticationSuccessHandler; 9 | import org.springframework.stereotype.Component; 10 | 11 | /** 12 | * 表单登录配置 13 | */ 14 | @Component 15 | public class FormAuthenticationConfig { 16 | 17 | @Autowired 18 | protected AuthenticationSuccessHandler imoocAuthenticationSuccessHandler; 19 | 20 | @Autowired 21 | protected AuthenticationFailureHandler imoocAuthenticationFailureHandler; 22 | 23 | public void configure(HttpSecurity http) throws Exception { 24 | http.formLogin() 25 | .loginPage(SecurityConstants.DEFAULT_UNAUTHENTICATION_URL) 26 | .loginProcessingUrl(SecurityConstants.DEFAULT_LOGIN_PROCESSING_URL_FORM) 27 | .successHandler(imoocAuthenticationSuccessHandler) 28 | .failureHandler(imoocAuthenticationFailureHandler); 29 | } 30 | 31 | } 32 | 33 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/authorize/AuthorizeConfigManager.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.authorize; 2 | 3 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 4 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; 5 | 6 | 7 | /** 8 | * 授权信息管理器 9 | * 10 | * 用于收集系统中所有 AuthorizeConfigProvider 并加载其配置 11 | */ 12 | public interface AuthorizeConfigManager { 13 | 14 | /** 15 | * @param config 16 | */ 17 | void config(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry config); 18 | 19 | } 20 | 21 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/authorize/AuthorizeConfigProvider.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.authorize; 2 | 3 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 4 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; 5 | 6 | 7 | public interface AuthorizeConfigProvider { 8 | 9 | /** 10 | * @param config 11 | * @return 返回的boolean表示配置中是否有针对anyRequest的配置。在整个授权配置中, 12 | * 应该有且仅有一个针对anyRequest的配置,如果所有的实现都没有针对anyRequest的配置, 13 | * 系统会自动增加一个anyRequest().authenticated()的配置。如果有多个针对anyRequest 14 | * 的配置,则会抛出异常。 15 | */ 16 | boolean config(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry config); 17 | } 18 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/ImageCodeProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | /** 4 | * 图片验证码选项 5 | */ 6 | public class ImageCodeProperties extends SmsCodeProperties { 7 | 8 | public ImageCodeProperties() { 9 | setLength(4); 10 | } 11 | 12 | /** 13 | * 验证码的宽 14 | */ 15 | private int width = 67; 16 | 17 | /** 18 | * 验证码的高 19 | */ 20 | private int height = 23; 21 | 22 | public int getWidth() { 23 | return width; 24 | } 25 | public void setWidth(int width) { 26 | this.width = width; 27 | } 28 | public int getHeight() { 29 | return height; 30 | } 31 | public void setHeight(int height) { 32 | this.height = height; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/LoginResponseType.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | public enum LoginResponseType { 4 | 5 | /** 6 | * 跳转 7 | */ 8 | REDIRECT, 9 | 10 | /** 11 | * 返回json 12 | */ 13 | JSON 14 | 15 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/OAuth2ClientProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | /** 4 | * 认证服务器注册的第三方应用配置项 5 | */ 6 | public class OAuth2ClientProperties { 7 | 8 | /** 9 | * 第三方应用appId 10 | */ 11 | private String clientId; 12 | /** 13 | * 第三方应用appSecret 14 | */ 15 | private String clientSecret; 16 | /** 17 | * 针对此应用发出的token的有效时间 18 | */ 19 | private int accessTokenValidateSeconds = 7200; 20 | 21 | public String getClientId() { 22 | return clientId; 23 | } 24 | 25 | public void setClientId(String clientId) { 26 | this.clientId = clientId; 27 | } 28 | 29 | public String getClientSecret() { 30 | return clientSecret; 31 | } 32 | 33 | public void setClientSecret(String clientSecret) { 34 | this.clientSecret = clientSecret; 35 | } 36 | 37 | public int getAccessTokenValidateSeconds() { 38 | return accessTokenValidateSeconds; 39 | } 40 | 41 | public void setAccessTokenValidateSeconds(int accessTokenValidateSeconds) { 42 | this.accessTokenValidateSeconds = accessTokenValidateSeconds; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/OAuth2Properties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | 4 | /** 5 | * oauth2配置 6 | */ 7 | public class OAuth2Properties { 8 | 9 | /** 10 | * 客户端配置 11 | */ 12 | private OAuth2ClientProperties[] clients = {}; 13 | 14 | /** 15 | * jwt的签名 16 | */ 17 | private String jwtSigningKey = "earthchen"; 18 | 19 | public OAuth2ClientProperties[] getClients() { 20 | return clients; 21 | } 22 | 23 | public void setClients(OAuth2ClientProperties[] clients) { 24 | this.clients = clients; 25 | } 26 | 27 | public String getJwtSigningKey() { 28 | return jwtSigningKey; 29 | } 30 | 31 | public void setJwtSigningKey(String jwtSigningKey) { 32 | this.jwtSigningKey = jwtSigningKey; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/QQProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | import org.springframework.boot.autoconfigure.social.SocialProperties; 4 | 5 | /** 6 | * qq登录配置项 7 | */ 8 | public class QQProperties extends SocialProperties { 9 | 10 | /** 11 | * providerId 12 | */ 13 | private String providerId = "qq"; 14 | 15 | public String getProviderId() { 16 | return providerId; 17 | } 18 | 19 | public void setProviderId(String providerId) { 20 | this.providerId = providerId; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/SessionProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | /** 4 | * session配置 5 | */ 6 | public class SessionProperties { 7 | 8 | /** 9 | * 同一个用户在系统中的最大session数,默认1 10 | */ 11 | private int maximumSessions = 1; 12 | /** 13 | * 达到最大session时是否阻止新的登录请求,默认为false,不阻止,新的登录会将老的登录失效掉 14 | */ 15 | private boolean maxSessionsPreventsLogin; 16 | /** 17 | * session失效时跳转的地址 18 | */ 19 | private String sessionInvalidUrl = SecurityConstants.DEFAULT_SESSION_INVALID_URL; 20 | 21 | public int getMaximumSessions() { 22 | return maximumSessions; 23 | } 24 | 25 | public void setMaximumSessions(int maximumSessions) { 26 | this.maximumSessions = maximumSessions; 27 | } 28 | 29 | public boolean isMaxSessionsPreventsLogin() { 30 | return maxSessionsPreventsLogin; 31 | } 32 | 33 | public void setMaxSessionsPreventsLogin(boolean maxSessionsPreventsLogin) { 34 | this.maxSessionsPreventsLogin = maxSessionsPreventsLogin; 35 | } 36 | 37 | public String getSessionInvalidUrl() { 38 | return sessionInvalidUrl; 39 | } 40 | 41 | public void setSessionInvalidUrl(String sessionInvalidUrl) { 42 | this.sessionInvalidUrl = sessionInvalidUrl; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/SmsCodeProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | /** 4 | * 短信验证码配置项 5 | */ 6 | public class SmsCodeProperties { 7 | 8 | /** 9 | * 短信验证码的长度 10 | */ 11 | private int length = 6; 12 | 13 | /** 14 | * 过期时间 15 | */ 16 | private int expireIn = 60; 17 | 18 | /** 19 | * 需要处理的url 20 | */ 21 | private String url; 22 | 23 | 24 | public int getLength() { 25 | return length; 26 | } 27 | 28 | public void setLength(int lenght) { 29 | this.length = lenght; 30 | } 31 | 32 | public int getExpireIn() { 33 | return expireIn; 34 | } 35 | 36 | public void setExpireIn(int expireIn) { 37 | this.expireIn = expireIn; 38 | } 39 | 40 | public String getUrl() { 41 | return url; 42 | } 43 | 44 | public void setUrl(String url) { 45 | this.url = url; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/SocialProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | /** 4 | * 社交登录相关配置项 5 | */ 6 | public class SocialProperties { 7 | 8 | /** 9 | * qq配置项 10 | * 11 | * @return 12 | */ 13 | private QQProperties qq = new QQProperties(); 14 | 15 | /** 16 | * 微信配置项 17 | */ 18 | private WeixinProperties weixin = new WeixinProperties(); 19 | 20 | /** 21 | * 拦截社交登录过滤url 22 | */ 23 | private String filterProcessesUrl = "/auth"; 24 | 25 | public QQProperties getQq() { 26 | return qq; 27 | } 28 | 29 | public void setQq(QQProperties qq) { 30 | this.qq = qq; 31 | } 32 | 33 | public String getFilterProcessesUrl() { 34 | return filterProcessesUrl; 35 | } 36 | 37 | public void setFilterProcessesUrl(String filterProcessesUrl) { 38 | this.filterProcessesUrl = filterProcessesUrl; 39 | } 40 | 41 | public WeixinProperties getWeixin() { 42 | return weixin; 43 | } 44 | 45 | public void setWeixin(WeixinProperties weixin) { 46 | this.weixin = weixin; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/ValidateCodeProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | /** 4 | * 验证码配置 5 | *

6 | * 图形验证码和短信验证码 7 | */ 8 | public class ValidateCodeProperties { 9 | 10 | /** 11 | * 图片验证码选项 12 | */ 13 | private ImageCodeProperties imageCode = new ImageCodeProperties(); 14 | 15 | /** 16 | * 短信验证码 17 | */ 18 | private SmsCodeProperties smsCode = new SmsCodeProperties(); 19 | 20 | 21 | public SmsCodeProperties getSmsCode() { 22 | return smsCode; 23 | } 24 | 25 | public void setSmsCode(SmsCodeProperties smsCode) { 26 | this.smsCode = smsCode; 27 | } 28 | 29 | public ImageCodeProperties getImageCode() { 30 | return imageCode; 31 | } 32 | 33 | public void setImageCode(ImageCodeProperties imageCode) { 34 | this.imageCode = imageCode; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/properties/WeixinProperties.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.properties; 2 | 3 | import org.springframework.boot.autoconfigure.social.SocialProperties; 4 | 5 | 6 | /** 7 | * 微信登录配置项 8 | */ 9 | public class WeixinProperties extends SocialProperties { 10 | 11 | /** 12 | * 第三方id,用来决定发起第三方登录的url,默认是 weixin。 13 | */ 14 | private String providerId = "weixin"; 15 | 16 | /** 17 | * @return the providerId 18 | */ 19 | public String getProviderId() { 20 | return providerId; 21 | } 22 | 23 | /** 24 | * @param providerId the providerId to set 25 | */ 26 | public void setProviderId(String providerId) { 27 | this.providerId = providerId; 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/qq/api/QQ.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.qq.api; 2 | 3 | 4 | 5 | /** 6 | * qq的api 7 | */ 8 | public interface QQ { 9 | 10 | /** 11 | * 获取qq的用户信息 12 | * @return 13 | */ 14 | QQUserInfo getUserInfo() ; 15 | 16 | } 17 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/qq/config/QQAutoConfig.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.qq.config; 2 | 3 | import com.earthchen.security.core.properties.QQProperties; 4 | import com.earthchen.security.core.properties.SecurityProperties; 5 | import com.earthchen.security.core.social.qq.connet.QQConnectionFactory; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 8 | import org.springframework.boot.autoconfigure.social.SocialAutoConfigurerAdapter; 9 | import org.springframework.context.annotation.Configuration; 10 | import org.springframework.social.connect.ConnectionFactory; 11 | 12 | @Configuration 13 | @ConditionalOnProperty(prefix = "earthchen.security.social.qq", name = "app-id") 14 | public class QQAutoConfig extends SocialAutoConfigurerAdapter { 15 | 16 | @Autowired 17 | private SecurityProperties securityProperties; 18 | 19 | /** 20 | * qq连接工厂 21 | * @return 22 | */ 23 | @Override 24 | protected ConnectionFactory createConnectionFactory() { 25 | QQProperties qqProperties = securityProperties.getSocial().getQq(); 26 | return new QQConnectionFactory( 27 | qqProperties.getProviderId(), 28 | qqProperties.getAppId(), 29 | qqProperties.getAppSecret()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/qq/connet/QQConnectionFactory.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.qq.connet; 2 | 3 | import com.earthchen.security.core.social.qq.api.QQ; 4 | import org.springframework.social.connect.support.OAuth2ConnectionFactory; 5 | 6 | /** 7 | * qq连接工厂 8 | */ 9 | public class QQConnectionFactory extends OAuth2ConnectionFactory { 10 | 11 | public QQConnectionFactory(String providerId, String appId, String appSecret) { 12 | super(providerId, new QQServiceProvider(appId, appSecret), new QQAdapter()); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/support/SocialAuthenticationFilterPostProcessor.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.support; 2 | 3 | import org.springframework.social.security.SocialAuthenticationFilter; 4 | 5 | /** 6 | * 社交认证过滤器后处理器 7 | */ 8 | public interface SocialAuthenticationFilterPostProcessor { 9 | 10 | void process(SocialAuthenticationFilter socialAuthenticationFilter); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/support/SocialUserInfo.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.support; 2 | 3 | /** 4 | * 社交用户信息 5 | */ 6 | public class SocialUserInfo { 7 | 8 | /** 9 | * 第三方登录的providerId 10 | */ 11 | private String providerId; 12 | 13 | /** 14 | * openid 15 | */ 16 | private String providerUserId; 17 | 18 | /** 19 | * 用户的昵称 20 | */ 21 | private String nickname; 22 | 23 | /** 24 | * 用户的头像 25 | */ 26 | private String headimg; 27 | 28 | public String getProviderId() { 29 | return providerId; 30 | } 31 | 32 | public void setProviderId(String providerId) { 33 | this.providerId = providerId; 34 | } 35 | 36 | public String getProviderUserId() { 37 | return providerUserId; 38 | } 39 | 40 | public void setProviderUserId(String providerUserId) { 41 | this.providerUserId = providerUserId; 42 | } 43 | 44 | public String getNickname() { 45 | return nickname; 46 | } 47 | 48 | public void setNickname(String nickname) { 49 | this.nickname = nickname; 50 | } 51 | 52 | public String getHeadimg() { 53 | return headimg; 54 | } 55 | 56 | public void setHeadimg(String headimg) { 57 | this.headimg = headimg; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/view/ImoocConnectView.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.view; 2 | 3 | import java.util.Map; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | 8 | import org.springframework.web.servlet.view.AbstractView; 9 | 10 | /** 11 | * 绑定结果视图 12 | */ 13 | public class ImoocConnectView extends AbstractView { 14 | 15 | /* 16 | * (non-Javadoc) 17 | * 18 | * @see 19 | * org.springframework.web.servlet.view.AbstractView#renderMergedOutputModel 20 | * (java.util.Map, javax.servlet.http.HttpServletRequest, 21 | * javax.servlet.http.HttpServletResponse) 22 | */ 23 | @Override 24 | protected void renderMergedOutputModel(Map model, HttpServletRequest request, 25 | HttpServletResponse response) throws Exception { 26 | 27 | response.setContentType("text/html;charset=UTF-8"); 28 | if (model.get("connections") == null) { 29 | response.getWriter().write("

解绑成功

"); 30 | } else { 31 | response.getWriter().write("

绑定成功

"); 32 | } 33 | 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/weixin/api/Weixin.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.weixin.api; 2 | 3 | public interface Weixin { 4 | 5 | WeixinUserInfo getUserInfo(String openId); 6 | } 7 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/weixin/connet/WeixinAccessGrant.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.weixin.connet; 2 | 3 | 4 | import org.springframework.social.oauth2.AccessGrant; 5 | 6 | /** 7 | * 微信的access_token信息。与标准OAuth2协议不同,微信在获取access_token时会同时返回openId,并没有单独的通过accessToke换取openId的服务 8 | * 9 | * 所以在这里继承了标准AccessGrant,添加了openId字段,作为对微信access_token信息的封装。 10 | * 11 | * 12 | */ 13 | public class WeixinAccessGrant extends AccessGrant { 14 | 15 | /** 16 | * 17 | */ 18 | private static final long serialVersionUID = -7243374526633186782L; 19 | 20 | private String openId; 21 | 22 | public WeixinAccessGrant() { 23 | super(""); 24 | } 25 | 26 | public WeixinAccessGrant(String accessToken, String scope, String refreshToken, Long expiresIn) { 27 | super(accessToken, scope, refreshToken, expiresIn); 28 | } 29 | 30 | /** 31 | * @return the openId 32 | */ 33 | public String getOpenId() { 34 | return openId; 35 | } 36 | 37 | /** 38 | * @param openId the openId to set 39 | */ 40 | public void setOpenId(String openId) { 41 | this.openId = openId; 42 | } 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/social/weixin/connet/WeixinServiceProvider.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.social.weixin.connet; 2 | 3 | import com.earthchen.security.core.social.weixin.api.Weixin; 4 | import com.earthchen.security.core.social.weixin.api.WeixinImpl; 5 | import org.springframework.social.oauth2.AbstractOAuth2ServiceProvider; 6 | 7 | /** 8 | * 微信的OAuth2流程处理器的提供器,供spring social的connect体系调用 9 | */ 10 | public class WeixinServiceProvider extends AbstractOAuth2ServiceProvider { 11 | 12 | /** 13 | * 微信获取授权码的url 14 | */ 15 | private static final String URL_AUTHORIZE = "https://open.weixin.qq.com/connect/qrconnect"; 16 | /** 17 | * 微信获取accessToken的url 18 | */ 19 | private static final String URL_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token"; 20 | 21 | /** 22 | * @param appId 23 | * @param appSecret 24 | */ 25 | public WeixinServiceProvider(String appId, String appSecret) { 26 | super(new WeixinOAuth2Template(appId, appSecret, URL_AUTHORIZE, URL_ACCESS_TOKEN)); 27 | } 28 | 29 | 30 | /* (non-Javadoc) 31 | * @see org.springframework.social.oauth2.AbstractOAuth2ServiceProvider#getApi(java.lang.String) 32 | */ 33 | @Override 34 | public Weixin getApi(String accessToken) { 35 | return new WeixinImpl(accessToken); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/support/SimpleResponse.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.support; 2 | 3 | public class SimpleResponse { 4 | 5 | public SimpleResponse(Object content){ 6 | this.content = content; 7 | } 8 | 9 | private Object content; 10 | 11 | public Object getContent() { 12 | return content; 13 | } 14 | 15 | public void setContent(Object content) { 16 | this.content = content; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCode.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | import java.io.Serializable; 4 | import java.time.LocalDateTime; 5 | 6 | /** 7 | * 验证码父类 8 | */ 9 | public class ValidateCode implements Serializable{ 10 | 11 | private static final long serialVersionUID = -436475944223625617L; 12 | 13 | private String code; 14 | 15 | private LocalDateTime expireTime; 16 | 17 | public ValidateCode(String code, int expireIn){ 18 | this.code = code; 19 | this.expireTime = LocalDateTime.now().plusSeconds(expireIn); 20 | } 21 | 22 | public ValidateCode(String code, LocalDateTime expireTime){ 23 | this.code = code; 24 | this.expireTime = expireTime; 25 | } 26 | 27 | public boolean isExpried() { 28 | return LocalDateTime.now().isAfter(expireTime); 29 | } 30 | 31 | public String getCode() { 32 | return code; 33 | } 34 | 35 | public void setCode(String code) { 36 | this.code = code; 37 | } 38 | 39 | public LocalDateTime getExpireTime() { 40 | return expireTime; 41 | } 42 | 43 | public void setExpireTime(LocalDateTime expireTime) { 44 | this.expireTime = expireTime; 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeException.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | import org.springframework.security.core.AuthenticationException; 4 | 5 | /** 6 | * 验证码异常 7 | *

8 | * 继承身份验证异常的基类 9 | */ 10 | public class ValidateCodeException extends AuthenticationException { 11 | 12 | private static final long serialVersionUID = 1L; 13 | 14 | /** 15 | * 实现一个父类的构造方法 16 | * 17 | * @param msg 18 | */ 19 | public ValidateCodeException(String msg) { 20 | super(msg); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeGenerator.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | import org.springframework.web.context.request.ServletWebRequest; 4 | 5 | /** 6 | * 验证码接口 7 | */ 8 | public interface ValidateCodeGenerator { 9 | /** 10 | * 图形验证码实现方法接口 11 | * @param request 12 | * @return 13 | */ 14 | ValidateCode generate(ServletWebRequest request); 15 | 16 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeProcessor.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | 4 | import org.springframework.web.context.request.ServletWebRequest; 5 | 6 | /** 7 | * 验证码处理器,封装不同的验证码处理逻辑 8 | */ 9 | public interface ValidateCodeProcessor { 10 | 11 | /** 12 | * 验证码放入session时的前缀 13 | */ 14 | String SESSION_KEY_PREFIX = "SESSION_KEY_FOR_CODE_"; 15 | 16 | 17 | /** 18 | * 创建校验码 19 | * 20 | * @param servletWebRequest 21 | * @throws Exception 22 | */ 23 | void create(ServletWebRequest servletWebRequest) throws Exception; 24 | 25 | /** 26 | * 校验验证码 27 | * 28 | * @param servletWebRequest 29 | * @throws Exception 30 | */ 31 | void validate(ServletWebRequest servletWebRequest); 32 | } 33 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeProcessorHolder.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | import java.util.Map; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Component; 7 | 8 | /** 9 | * @author zhailiang 10 | * 11 | */ 12 | @Component 13 | public class ValidateCodeProcessorHolder { 14 | 15 | @Autowired 16 | private Map validateCodeProcessors; 17 | 18 | public ValidateCodeProcessor findValidateCodeProcessor(ValidateCodeType type) { 19 | return findValidateCodeProcessor(type.toString().toLowerCase()); 20 | } 21 | 22 | public ValidateCodeProcessor findValidateCodeProcessor(String type) { 23 | String name = type.toLowerCase() + ValidateCodeProcessor.class.getSimpleName(); 24 | ValidateCodeProcessor processor = validateCodeProcessors.get(name); 25 | if (processor == null) { 26 | throw new ValidateCodeException("验证码处理器" + name + "不存在"); 27 | } 28 | return processor; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeRepository.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | import org.springframework.web.context.request.ServletWebRequest; 4 | 5 | /** 6 | * 校验码存取器 7 | */ 8 | public interface ValidateCodeRepository { 9 | 10 | /** 11 | * 保存验证码 12 | * 13 | * @param request 14 | * @param code 15 | * @param validateCodeType 16 | */ 17 | void save(ServletWebRequest request, ValidateCode code, ValidateCodeType validateCodeType); 18 | 19 | /** 20 | * 获取验证码 21 | * 22 | * @param request 23 | * @param validateCodeType 24 | * @return 25 | */ 26 | ValidateCode get(ServletWebRequest request, ValidateCodeType validateCodeType); 27 | 28 | /** 29 | * 移除验证码 30 | * 31 | * @param request 32 | * @param codeType 33 | */ 34 | void remove(ServletWebRequest request, ValidateCodeType codeType); 35 | } 36 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeSecurityConfig.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | import javax.servlet.Filter; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.security.config.annotation.SecurityConfigurerAdapter; 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 8 | import org.springframework.security.web.DefaultSecurityFilterChain; 9 | import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * @author zhailiang 14 | * 15 | */ 16 | @Component("validateCodeSecurityConfig") 17 | public class ValidateCodeSecurityConfig extends SecurityConfigurerAdapter { 18 | 19 | @Autowired 20 | private Filter validateCodeFilter; 21 | 22 | @Override 23 | public void configure(HttpSecurity http) throws Exception { 24 | http.addFilterBefore(validateCodeFilter, AbstractPreAuthenticatedProcessingFilter.class); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/ValidateCodeType.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code; 2 | 3 | 4 | import com.earthchen.security.core.properties.SecurityConstants; 5 | 6 | /** 7 | * 验证码类型 8 | */ 9 | public enum ValidateCodeType { 10 | 11 | /** 12 | * 短信验证码 13 | */ 14 | SMS { 15 | @Override 16 | public String getParamNameOnValidate() { 17 | return SecurityConstants.DEFAULT_PARAMETER_NAME_CODE_SMS; 18 | } 19 | }, 20 | /** 21 | * 图片验证码 22 | */ 23 | IMAGE { 24 | @Override 25 | public String getParamNameOnValidate() { 26 | return SecurityConstants.DEFAULT_PARAMETER_NAME_CODE_IMAGE; 27 | } 28 | }; 29 | 30 | /** 31 | * 校验时从请求中获取的参数的名字 32 | * @return 33 | */ 34 | public abstract String getParamNameOnValidate(); 35 | } 36 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/image/ImageCode.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code.image; 2 | 3 | import com.earthchen.security.core.validate.code.ValidateCode; 4 | 5 | import java.awt.image.BufferedImage; 6 | import java.time.LocalDateTime; 7 | 8 | /** 9 | * 图片验证码 10 | */ 11 | public class ImageCode extends ValidateCode { 12 | 13 | private static final long serialVersionUID = -500010999504413020L; 14 | 15 | private BufferedImage image; 16 | 17 | public ImageCode(BufferedImage image, String code, int expireIn){ 18 | super(code, expireIn); 19 | this.image = image; 20 | } 21 | 22 | public ImageCode(BufferedImage image, String code, LocalDateTime expireTime){ 23 | super(code, expireTime); 24 | this.image = image; 25 | } 26 | 27 | public BufferedImage getImage() { 28 | return image; 29 | } 30 | 31 | public void setImage(BufferedImage image) { 32 | this.image = image; 33 | } 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/image/ImageCodeProcessor.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code.image; 2 | 3 | import com.earthchen.security.core.validate.code.impl.AbstractValidateCodeProcessor; 4 | import org.springframework.stereotype.Component; 5 | import org.springframework.web.context.request.ServletWebRequest; 6 | 7 | import javax.imageio.ImageIO; 8 | 9 | /** 10 | * 图片验证码处理器 11 | */ 12 | @Component("imageValidateCodeProcessor") 13 | public class ImageCodeProcessor extends AbstractValidateCodeProcessor { 14 | 15 | /** 16 | * 发送图形验证码,将其写到响应中 17 | */ 18 | @Override 19 | protected void send(ServletWebRequest request, ImageCode imageCode) throws Exception { 20 | ImageIO.write(imageCode.getImage(), "JPEG", request.getResponse().getOutputStream()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/sms/DefaultSmsCodeSender.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code.sms; 2 | 3 | /** 4 | * 默认的短信验证码发送方法实现 5 | */ 6 | public class DefaultSmsCodeSender implements SmsCodeSender { 7 | 8 | /** 9 | * 发送方法逻辑 10 | * @param mobile 手机号 11 | * @param code 验证码 12 | */ 13 | @Override 14 | public void send(String mobile, String code) { 15 | System.out.println("向手机"+mobile+"发送短信验证码"+code); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/sms/SmsCodeGenerator.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code.sms; 2 | 3 | import com.earthchen.security.core.properties.SecurityProperties; 4 | import com.earthchen.security.core.validate.code.ValidateCode; 5 | import com.earthchen.security.core.validate.code.ValidateCodeGenerator; 6 | import org.apache.commons.lang.RandomStringUtils; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Component; 9 | import org.springframework.web.context.request.ServletWebRequest; 10 | 11 | /** 12 | * 短信验证码生成器 13 | */ 14 | @Component("smsValidateCodeGenerator") 15 | public class SmsCodeGenerator implements ValidateCodeGenerator { 16 | 17 | 18 | @Autowired 19 | private SecurityProperties securityProperties; 20 | 21 | @Override 22 | public ValidateCode generate(ServletWebRequest request) { 23 | String code = RandomStringUtils.randomNumeric(securityProperties.getValidateCode().getSmsCode().getLength()); 24 | return new ValidateCode(code, securityProperties.getValidateCode().getSmsCode().getExpireIn()); 25 | } 26 | 27 | 28 | public SecurityProperties getSecurityProperties() { 29 | return securityProperties; 30 | } 31 | 32 | public void setSecurityProperties(SecurityProperties securityProperties) { 33 | this.securityProperties = securityProperties; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/sms/SmsCodeProcessor.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code.sms; 2 | 3 | import com.earthchen.security.core.properties.SecurityConstants; 4 | import com.earthchen.security.core.validate.code.ValidateCode; 5 | import com.earthchen.security.core.validate.code.impl.AbstractValidateCodeProcessor; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.bind.ServletRequestUtils; 9 | import org.springframework.web.context.request.ServletWebRequest; 10 | 11 | /** 12 | * 短信验证码处理器 13 | */ 14 | @Component("smsValidateCodeProcessor") 15 | public class SmsCodeProcessor extends AbstractValidateCodeProcessor { 16 | 17 | /** 18 | * 短信验证码发送器 19 | */ 20 | @Autowired 21 | private SmsCodeSender smsCodeSender; 22 | 23 | @Override 24 | protected void send(ServletWebRequest request, ValidateCode validateCode) throws Exception { 25 | String paramName = SecurityConstants.DEFAULT_PARAMETER_NAME_MOBILE; 26 | String mobile = ServletRequestUtils.getRequiredStringParameter(request.getRequest(), paramName); 27 | smsCodeSender.send(mobile, validateCode.getCode()); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /security-core/src/main/java/com/earthchen/security/core/validate/code/sms/SmsCodeSender.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security.core.validate.code.sms; 2 | 3 | /** 4 | * 短信发送接口 5 | */ 6 | public interface SmsCodeSender { 7 | 8 | /** 9 | * 发送方法 10 | * @param mobile 手机号 11 | * @param code 验证码 12 | */ 13 | void send(String mobile, String code); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-core/target/classes/META-INF/spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "hints": [], 3 | "groups": [ 4 | { 5 | "sourceType": "com.earthchen.security.core.properties.SecurityProperties", 6 | "name": "earthchen.security", 7 | "type": "com.earthchen.security.core.properties.SecurityProperties" 8 | } 9 | ], 10 | "properties": [ 11 | { 12 | "sourceType": "com.earthchen.security.core.properties.SecurityProperties", 13 | "name": "earthchen.security.browser", 14 | "description": "浏览器端配置", 15 | "type": "com.earthchen.security.core.properties.BrowserProperties" 16 | }, 17 | { 18 | "sourceType": "com.earthchen.security.core.properties.SecurityProperties", 19 | "name": "earthchen.security.oauth2", 20 | "description": "OAuth2认证服务器配置", 21 | "type": "com.earthchen.security.core.properties.OAuth2Properties" 22 | }, 23 | { 24 | "sourceType": "com.earthchen.security.core.properties.SecurityProperties", 25 | "name": "earthchen.security.social", 26 | "description": "社交登录相关配置", 27 | "type": "com.earthchen.security.core.properties.SocialProperties" 28 | }, 29 | { 30 | "sourceType": "com.earthchen.security.core.properties.SecurityProperties", 31 | "name": "earthchen.security.validate-code", 32 | "description": "验证码配置", 33 | "type": "com.earthchen.security.core.properties.ValidateCodeProperties" 34 | } 35 | ] 36 | } -------------------------------------------------------------------------------- /security-core/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Fri Dec 15 11:34:01 CST 2017 3 | version=1.0-SNAPSHOT 4 | groupId=com.earthchen 5 | artifactId=security-core 6 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/DemoApplication.java: -------------------------------------------------------------------------------- 1 | package com.earthchen; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | public class DemoApplication { 9 | 10 | public static void main(String[] args){ 11 | SpringApplication.run(DemoApplication.class,args); 12 | } 13 | 14 | 15 | } 16 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/code/DemoImageCodeGenerator.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.code; 2 | 3 | import com.earthchen.security.core.validate.code.image.ImageCode; 4 | import com.earthchen.security.core.validate.code.ValidateCodeGenerator; 5 | import org.springframework.web.context.request.ServletWebRequest; 6 | 7 | /** 8 | * 自定义验证码生成器 9 | */ 10 | //@Component("imageValidateCodeGenerator") 11 | public class DemoImageCodeGenerator implements ValidateCodeGenerator { 12 | 13 | /** 14 | * 新的验证码生成逻辑 15 | * @param request 16 | * @return 17 | */ 18 | @Override 19 | public ImageCode generate(ServletWebRequest request) { 20 | System.out.println("更高级的图形验证码生成代码"); 21 | return null; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/dto/FileInfo.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.dto; 2 | 3 | public class FileInfo { 4 | 5 | public FileInfo(String path){ 6 | this.path = path; 7 | } 8 | 9 | private String path; 10 | 11 | public String getPath() { 12 | return path; 13 | } 14 | 15 | public void setPath(String path) { 16 | this.path = path; 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/dto/UserQueryCondition.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.dto; 2 | 3 | 4 | import io.swagger.annotations.ApiModelProperty; 5 | 6 | /** 7 | * 用户查询条件类 8 | */ 9 | public class UserQueryCondition { 10 | 11 | public String getUsername() { 12 | return username; 13 | } 14 | 15 | public void setUsername(String username) { 16 | this.username = username; 17 | } 18 | 19 | public int getAge() { 20 | return age; 21 | } 22 | 23 | public void setAge(int age) { 24 | this.age = age; 25 | } 26 | 27 | public int getAgeTo() { 28 | return ageTo; 29 | } 30 | 31 | public void setAgeTo(int ageTo) { 32 | this.ageTo = ageTo; 33 | } 34 | 35 | public String getXxx() { 36 | return xxx; 37 | } 38 | 39 | public void setXxx(String xxx) { 40 | this.xxx = xxx; 41 | } 42 | 43 | private String username; 44 | 45 | @ApiModelProperty(value = "用户年龄起始值") 46 | private int age; 47 | 48 | @ApiModelProperty(value = "用户年龄终止值") 49 | private int ageTo; 50 | 51 | private String xxx; 52 | } 53 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/excepetion/UserNotExistException.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.excepetion; 2 | 3 | 4 | public class UserNotExistException extends RuntimeException { 5 | 6 | 7 | private static final long serialVersionUID=-1L; 8 | 9 | public String getId() { 10 | return id; 11 | } 12 | 13 | public void setId(String id) { 14 | this.id = id; 15 | } 16 | 17 | private String id; 18 | 19 | 20 | public UserNotExistException(String id){ 21 | super("user not exist"); 22 | this.id=id; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/security/DemoAuthorizeConfigProvider.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security; 2 | 3 | import com.earthchen.security.core.authorize.AuthorizeConfigProvider; 4 | import org.springframework.core.annotation.Order; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; 7 | import org.springframework.stereotype.Component; 8 | 9 | 10 | @Component 11 | @Order(Integer.MAX_VALUE) 12 | public class DemoAuthorizeConfigProvider implements AuthorizeConfigProvider { 13 | 14 | /** 15 | * demo项目授权配置 16 | * @param config 17 | * @return 18 | */ 19 | @Override 20 | public boolean config(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry config) { 21 | //config.antMatchers("/demo.html").hasRole("ADMIN"); 22 | config.anyRequest().access("@rbacService.hasPermission(request,authentication)"); 23 | return true; 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/security/DemoConnectionSignUp.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.security; 2 | 3 | 4 | import org.springframework.social.connect.Connection; 5 | import org.springframework.social.connect.ConnectionSignUp; 6 | import org.springframework.stereotype.Component; 7 | 8 | 9 | /** 10 | * 配置ConnectionSignUp实现类 11 | * 12 | * 实现用户使用第三方登录完默认注册一个用户并登录 13 | */ 14 | @Component 15 | public class DemoConnectionSignUp implements ConnectionSignUp { 16 | 17 | /* (non-Javadoc) 18 | * @see org.springframework.social.connect.ConnectionSignUp#execute(org.springframework.social.connect.Connection) 19 | */ 20 | @Override 21 | public String execute(Connection connection) { 22 | //根据社交用户信息默认创建用户并返回用户唯一标识 23 | return connection.getDisplayName(); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/service/HelloService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.service; 2 | 3 | public interface HelloService { 4 | 5 | String greeting(String name); 6 | } 7 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/service/impl/HelloServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.service.impl; 2 | 3 | 4 | import com.earthchen.service.HelloService; 5 | import org.springframework.stereotype.Service; 6 | 7 | @Service 8 | public class HelloServiceImpl implements HelloService{ 9 | 10 | @Override 11 | public String greeting(String name) { 12 | System.out.println("greeting...."); 13 | return "hello "+name; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/validator/MyConstraintValidator.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.validator; 2 | 3 | import com.earthchen.service.HelloService; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | 6 | import javax.validation.ConstraintValidator; 7 | import javax.validation.ConstraintValidatorContext; 8 | 9 | public class MyConstraintValidator implements ConstraintValidator { 10 | 11 | @Autowired 12 | private HelloService helloService; 13 | 14 | /** 15 | * 校验器初始化 16 | * @param constraintAnnotation 17 | */ 18 | @Override 19 | public void initialize(MyValidConstraint constraintAnnotation) { 20 | System.out.println("MyConstraintValidator--init "); 21 | } 22 | 23 | /** 24 | * 真正的校验方法 25 | * @param value 26 | * @param context 27 | * @return 28 | */ 29 | @Override 30 | public boolean isValid(Object value, ConstraintValidatorContext context) { 31 | helloService.greeting("tom"); 32 | System.out.println(value); 33 | return false; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/validator/MyValidConstraint.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.validator; 2 | 3 | 4 | import javax.validation.Constraint; 5 | import javax.validation.Payload; 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | /** 12 | * 自定义校验器 13 | * 下面三个方法都是必须含有的 14 | */ 15 | @Target({ElementType.METHOD, ElementType.FIELD}) 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Constraint(validatedBy = MyConstraintValidator.class) 18 | public @interface MyValidConstraint { 19 | 20 | String message(); 21 | 22 | Class[] groups() default { }; 23 | 24 | Class[] payload() default { }; 25 | } 26 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/web/aspect/TimeAspect.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.web.aspect; 2 | 3 | 4 | import org.aspectj.lang.ProceedingJoinPoint; 5 | import org.aspectj.lang.annotation.Around; 6 | import org.aspectj.lang.annotation.Aspect; 7 | import org.springframework.stereotype.Component; 8 | 9 | import java.util.Date; 10 | 11 | /** 12 | * 使用注解声明切片 13 | */ 14 | @Aspect 15 | @Component 16 | public class TimeAspect { 17 | 18 | @Around("execution(* com.earthchen.web.controller.UserController.*(..))") 19 | public Object handleControllerMethod(ProceedingJoinPoint pjp) throws Throwable { 20 | System.out.println("time aspect start"); 21 | 22 | Object[] args = pjp.getArgs(); 23 | for (Object arg : args) { 24 | System.out.println("arg is " + arg); 25 | } 26 | 27 | long start = new Date().getTime(); 28 | 29 | Object object = pjp.proceed(); 30 | 31 | System.out.println("time aspect 耗时:" + (new Date().getTime() - start)); 32 | 33 | System.out.println("time aspect end"); 34 | 35 | return object; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/web/async/DeferredResultHolder.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.web.async; 2 | 3 | 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | import org.springframework.stereotype.Component; 8 | import org.springframework.web.context.request.async.DeferredResult; 9 | 10 | @Component 11 | public class DeferredResultHolder { 12 | 13 | private Map> map = new HashMap<>(); 14 | 15 | public Map> getMap() { 16 | return map; 17 | } 18 | 19 | public void setMap(Map> map) { 20 | this.map = map; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/web/async/MockQueue.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.web.async; 2 | 3 | 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | import org.springframework.stereotype.Component; 7 | 8 | @Component 9 | public class MockQueue { 10 | 11 | private String placeOrder; 12 | 13 | private String completeOrder; 14 | 15 | private Logger logger = LoggerFactory.getLogger(getClass()); 16 | 17 | public String getPlaceOrder() { 18 | return placeOrder; 19 | } 20 | 21 | public void setPlaceOrder(String placeOrder) throws Exception { 22 | new Thread(() -> { 23 | logger.info("接到下单请求, " + placeOrder); 24 | try { 25 | Thread.sleep(1000); 26 | } catch (Exception e) { 27 | e.printStackTrace(); 28 | } 29 | this.completeOrder = placeOrder; 30 | logger.info("下单请求处理完毕," + placeOrder); 31 | }).start(); 32 | } 33 | 34 | public String getCompleteOrder() { 35 | return completeOrder; 36 | } 37 | 38 | public void setCompleteOrder(String completeOrder) { 39 | this.completeOrder = completeOrder; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/web/config/Swagger2.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.web.config; 2 | 3 | import org.springframework.context.annotation.Bean; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | import springfox.documentation.builders.ApiInfoBuilder; 7 | import springfox.documentation.builders.PathSelectors; 8 | import springfox.documentation.builders.RequestHandlerSelectors; 9 | import springfox.documentation.service.ApiInfo; 10 | import springfox.documentation.spi.DocumentationType; 11 | import springfox.documentation.spring.web.plugins.Docket; 12 | import springfox.documentation.swagger2.annotations.EnableSwagger2; 13 | 14 | @Configuration 15 | @EnableSwagger2 16 | public class Swagger2 { 17 | 18 | @Bean 19 | public Docket createRestApi() { 20 | return new Docket(DocumentationType.SWAGGER_2) 21 | .apiInfo(apiInfo()) 22 | .select() 23 | .apis(RequestHandlerSelectors.basePackage("com.earthchen.web")) 24 | .paths(PathSelectors.any()) 25 | .build(); 26 | } 27 | 28 | private ApiInfo apiInfo() { 29 | return new ApiInfoBuilder() 30 | .title("spring security") 31 | .description("spring security") 32 | .termsOfServiceUrl("http://earthchen.cn/") 33 | .contact("EarthChen") 34 | .version("1.0") 35 | .build(); 36 | } 37 | } -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/web/controller/ControllerExceptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.web.controller; 2 | 3 | import com.earthchen.excepetion.UserNotExistException; 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.ResponseBody; 8 | import org.springframework.web.bind.annotation.ResponseStatus; 9 | 10 | import java.util.HashMap; 11 | import java.util.Map; 12 | 13 | /** 14 | * controller异常处理 15 | */ 16 | @ControllerAdvice 17 | public class ControllerExceptionHandler { 18 | 19 | /** 20 | * 返回值为 21 | * { 22 | "id": "1", 23 | "message": "user not exist" 24 | } 25 | * @param ex 26 | * @return 27 | */ 28 | @ExceptionHandler(UserNotExistException.class) 29 | @ResponseBody 30 | @ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR) 31 | public Map handleUserNotExistException(UserNotExistException ex) { 32 | Map result = new HashMap<>(); 33 | result.put("id", ex.getId()); 34 | result.put("message", ex.getMessage()); 35 | return result; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/web/filter/TimeFilter.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.web.filter; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import javax.servlet.*; 6 | import java.io.IOException; 7 | import java.util.Date; 8 | 9 | /** 10 | * 过滤器拦截请求 11 | */ 12 | //@Component 13 | public class TimeFilter implements Filter { 14 | 15 | @Override 16 | public void init(FilterConfig filterConfig) throws ServletException { 17 | System.out.println("time filter init"); 18 | } 19 | 20 | @Override 21 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { 22 | System.out.println("time filter start"); 23 | long start = new Date().getTime(); 24 | chain.doFilter(request, response); 25 | System.out.println("time filter 耗时:" + (new Date().getTime() - start)); 26 | System.out.println("time filter finish"); 27 | } 28 | 29 | @Override 30 | public void destroy() { 31 | System.out.println("time filter destroy"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /security-demo/src/main/java/com/earthchen/wiremock/MockServer.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.wiremock; 2 | 3 | 4 | import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; 5 | import static com.github.tomakehurst.wiremock.client.WireMock.configureFor; 6 | import static com.github.tomakehurst.wiremock.client.WireMock.get; 7 | import static com.github.tomakehurst.wiremock.client.WireMock.removeAllMappings; 8 | import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; 9 | import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; 10 | 11 | import java.io.IOException; 12 | 13 | import org.apache.commons.io.FileUtils; 14 | import org.apache.commons.lang.StringUtils; 15 | import org.springframework.core.io.ClassPathResource; 16 | 17 | public class MockServer { 18 | 19 | public static void main(String[] args) throws IOException { 20 | configureFor(8062); 21 | removeAllMappings(); 22 | 23 | mock("/order/1", "01"); 24 | mock("/order/2", "02"); 25 | } 26 | 27 | private static void mock(String url, String file) throws IOException { 28 | ClassPathResource resource = new ClassPathResource("mock/response/" + file + ".txt"); 29 | String content = StringUtils.join(FileUtils.readLines(resource.getFile(), "UTF-8").toArray(), "\n"); 30 | stubFor(get(urlPathEqualTo(url)).willReturn(aResponse().withBody(content).withStatus(200))); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/mock/response/01.txt: -------------------------------------------------------------------------------- 1 | { 2 | "id":1, 3 | "type":"C" 4 | } -------------------------------------------------------------------------------- /security-demo/src/main/resources/mock/response/02.txt: -------------------------------------------------------------------------------- 1 | { 2 | "id":2, 3 | "type":"B" 4 | } -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/demo-logout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | demo退出成功页 9 | 10 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/demo-signIn.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 |

Demo登录页

9 | 10 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/demo-signUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

Demo注册页

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 |
用户名:
密码:
22 | 23 | 24 |
27 |
28 | 29 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | DEMO 9 | 10 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/error/403.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 6 | 7 | 8 | 403错误 无权访问 9 | 10 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/error/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 404 not find 10 | 11 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/error/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 500 服务器内部错误 10 | 11 | -------------------------------------------------------------------------------- /security-demo/src/main/resources/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | index 9 | 退出登录 10 | 11 | -------------------------------------------------------------------------------- /security-demo/target/classes/mock/response/01.txt: -------------------------------------------------------------------------------- 1 | { 2 | "id":1, 3 | "type":"C" 4 | } -------------------------------------------------------------------------------- /security-demo/target/classes/mock/response/02.txt: -------------------------------------------------------------------------------- 1 | { 2 | "id":2, 3 | "type":"B" 4 | } -------------------------------------------------------------------------------- /security-demo/target/classes/resources/demo-logout.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | demo退出成功页 9 | 10 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/demo-signIn.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 |

Demo登录页

9 | 10 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/demo-signUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

Demo注册页

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 |
用户名:
密码:
22 | 23 | 24 |
27 |
28 | 29 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | DEMO 9 | 10 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/error/403.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 403 6 | 7 | 8 | 403错误 无权访问 9 | 10 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/error/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 404 not find 10 | 11 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/error/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 500 服务器内部错误 10 | 11 | -------------------------------------------------------------------------------- /security-demo/target/classes/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Insert title here 6 | 7 | 8 | index 9 | 退出登录 10 | 11 | -------------------------------------------------------------------------------- /security-demo/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Fri Dec 15 11:34:10 CST 2017 3 | version=1.0-SNAPSHOT 4 | groupId=com.earthchen 5 | artifactId=security-demo 6 | -------------------------------------------------------------------------------- /security-demo/target/security-demo.jar.original: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EarthChen/imooc-security-study/69e843d89d017953ec3e91b0701651ab4942eb43/security-demo/target/security-demo.jar.original -------------------------------------------------------------------------------- /security-demo/target/surefire-reports/com.earthchen.web.controller.UserControllerTest.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: com.earthchen.web.controller.UserControllerTest 3 | ------------------------------------------------------------------------------- 4 | Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 7.809 sec 5 | -------------------------------------------------------------------------------- /sso-client1/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sso-demo 7 | com.earthchen 8 | 1.0-SNAPSHOT 9 | ../sso-demo/pom.xml 10 | 11 | 4.0.0 12 | 13 | sso-client1 14 | 15 | 16 | 17 | org.springframework.boot 18 | spring-boot-starter-security 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | org.springframework.security.oauth 26 | spring-security-oauth2 27 | 28 | 29 | org.springframework.security 30 | spring-security-jwt 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sso-client1/src/main/java/com/earthchen/sso/client/SsoClient1Application.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.sso.client; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 6 | import org.springframework.security.core.Authentication; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | 11 | @SpringBootApplication 12 | @RestController 13 | @EnableOAuth2Sso 14 | public class SsoClient1Application { 15 | 16 | @GetMapping("/user") 17 | public Authentication user(Authentication user) { 18 | return user; 19 | } 20 | 21 | public static void main(String[] args){ 22 | SpringApplication.run(SsoClient1Application.class,args); 23 | } 24 | 25 | 26 | } -------------------------------------------------------------------------------- /sso-client1/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | oauth2: 3 | client: 4 | clientId: earthchen1 5 | clientSecret: earthchensecret1 6 | user-authorization-uri: http://127.0.0.1:9999/server/oauth/authorize 7 | access-token-uri: http://127.0.0.1:9999/server/oauth/token 8 | resource: 9 | jwt: 10 | key-uri: http://127.0.0.1:9999/server/oauth/token_key 11 | server: 12 | port: 8080 13 | context-path: /client1 14 | 15 | 16 | -------------------------------------------------------------------------------- /sso-client1/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SSO Client1 6 | 7 | 8 |

SSO Demo Client1

9 | 访问Client2 10 | 11 | -------------------------------------------------------------------------------- /sso-client1/target/classes/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | oauth2: 3 | client: 4 | clientId: earthchen1 5 | clientSecret: earthchensecret1 6 | user-authorization-uri: http://127.0.0.1:9999/server/oauth/authorize 7 | access-token-uri: http://127.0.0.1:9999/server/oauth/token 8 | resource: 9 | jwt: 10 | key-uri: http://127.0.0.1:9999/server/oauth/token_key 11 | server: 12 | port: 8080 13 | context-path: /client1 14 | 15 | 16 | -------------------------------------------------------------------------------- /sso-client1/target/classes/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SSO Client1 6 | 7 | 8 |

SSO Demo Client1

9 | 访问Client2 10 | 11 | -------------------------------------------------------------------------------- /sso-client2/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sso-demo 7 | com.earthchen 8 | 1.0-SNAPSHOT 9 | ../sso-demo/pom.xml 10 | 11 | 4.0.0 12 | 13 | sso-client2 14 | 15 | 16 | 17 | org.springframework.boot 18 | spring-boot-starter-security 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | org.springframework.security.oauth 26 | spring-security-oauth2 27 | 28 | 29 | org.springframework.security 30 | spring-security-jwt 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sso-client2/src/main/java/com/earthchen/sso/client/SsoClient2Application.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.sso.client; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso; 6 | import org.springframework.security.core.Authentication; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | @SpringBootApplication 11 | @RestController 12 | @EnableOAuth2Sso 13 | public class SsoClient2Application { 14 | 15 | @GetMapping("/user") 16 | public Authentication user(Authentication user) { 17 | return user; 18 | } 19 | 20 | public static void main(String[] args) { 21 | SpringApplication.run(SsoClient2Application.class, args); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /sso-client2/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | oauth2: 3 | client: 4 | client-id: earthchen2 5 | client-secret: earthchensecret2 6 | user-authorization-uri: http://127.0.0.1:9999/server/oauth/authorize 7 | access-token-uri: http://127.0.0.1:9999/server/oauth/token 8 | resource: 9 | jwt: 10 | key-uri: http://127.0.0.1:9999/server/oauth/token_key 11 | server: 12 | port: 8060 13 | context-path: /client2 -------------------------------------------------------------------------------- /sso-client2/src/main/resources/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SSO Client1 6 | 7 | 8 |

SSO Demo Client1

9 | 访问Client1 10 | 11 | -------------------------------------------------------------------------------- /sso-client2/target/classes/application.yml: -------------------------------------------------------------------------------- 1 | security: 2 | oauth2: 3 | client: 4 | client-id: earthchen2 5 | client-secret: earthchensecret2 6 | user-authorization-uri: http://127.0.0.1:9999/server/oauth/authorize 7 | access-token-uri: http://127.0.0.1:9999/server/oauth/token 8 | resource: 9 | jwt: 10 | key-uri: http://127.0.0.1:9999/server/oauth/token_key 11 | server: 12 | port: 8060 13 | context-path: /client2 -------------------------------------------------------------------------------- /sso-client2/target/classes/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SSO Client1 6 | 7 | 8 |

SSO Demo Client1

9 | 访问Client1 10 | 11 | -------------------------------------------------------------------------------- /sso-demo/sso-demo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /sso-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | sso-demo 7 | com.earthchen 8 | 1.0-SNAPSHOT 9 | ../sso-demo/pom.xml 10 | 11 | 4.0.0 12 | 13 | sso-server 14 | 15 | 16 | 17 | org.springframework.boot 18 | spring-boot-starter-security 19 | 20 | 21 | org.springframework.boot 22 | spring-boot-starter-web 23 | 24 | 25 | org.springframework.security.oauth 26 | spring-security-oauth2 27 | 28 | 29 | org.springframework.security 30 | spring-security-jwt 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /sso-server/src/main/java/com/earthchen/SsoServerApplication.java: -------------------------------------------------------------------------------- 1 | package com.earthchen; 2 | 3 | 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | 7 | @SpringBootApplication 8 | public class SsoServerApplication { 9 | 10 | public static void main(String[] args) { 11 | SpringApplication.run(SsoServerApplication.class, args); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /sso-server/src/main/java/com/earthchen/sso/server/SsoUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.earthchen.sso.server; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.security.core.authority.AuthorityUtils; 5 | import org.springframework.security.core.userdetails.User; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | import org.springframework.security.core.userdetails.UserDetailsService; 8 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 9 | import org.springframework.security.crypto.password.PasswordEncoder; 10 | import org.springframework.stereotype.Component; 11 | 12 | 13 | @Component 14 | public class SsoUserDetailsService implements UserDetailsService { 15 | 16 | @Autowired 17 | private PasswordEncoder passwordEncoder; 18 | 19 | /* (non-Javadoc) 20 | * @see org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername(java.lang.String) 21 | */ 22 | @Override 23 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 24 | return new User(username, passwordEncoder.encode("123456"), 25 | AuthorityUtils.commaSeparatedStringToAuthorityList("ROLE_USER")); 26 | } 27 | 28 | } -------------------------------------------------------------------------------- /sso-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9999 3 | context-path: /server 4 | security: 5 | user: 6 | password: 123456 7 | 8 | -------------------------------------------------------------------------------- /sso-server/target/classes/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 9999 3 | context-path: /server 4 | security: 5 | user: 6 | password: 123456 7 | 8 | -------------------------------------------------------------------------------- /test/src/main/java/com/earthchen/TestApplication.java: -------------------------------------------------------------------------------- 1 | package com.earthchen; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.security.core.Authentication; 7 | import org.springframework.social.connect.web.ProviderSignInUtils; 8 | import org.springframework.web.bind.annotation.GetMapping; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | import org.springframework.web.context.request.ServletWebRequest; 12 | 13 | import javax.servlet.http.HttpServletRequest; 14 | 15 | @SpringBootApplication 16 | @RestController 17 | public class TestApplication { 18 | 19 | @Autowired 20 | private ProviderSignInUtils providerSignInUtils; 21 | 22 | 23 | @GetMapping("/me") 24 | public Authentication me(Authentication user) { 25 | return user; 26 | } 27 | 28 | @PostMapping("/user/regist") 29 | public void regist(HttpServletRequest request) { 30 | providerSignInUtils.doPostSignUp("test", new ServletWebRequest(request)); 31 | } 32 | 33 | 34 | public static void main(String[] args) { 35 | SpringApplication.run(TestApplication.class, args); 36 | } 37 | 38 | } 39 | 40 | -------------------------------------------------------------------------------- /test/src/main/java/com/earthchen/TestAuthorizeConfigProvider.java: -------------------------------------------------------------------------------- 1 | package com.earthchen; 2 | 3 | import com.earthchen.security.core.authorize.AuthorizeConfigProvider; 4 | import org.springframework.http.HttpMethod; 5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; 6 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; 7 | import org.springframework.stereotype.Component; 8 | 9 | /** 10 | * 使用rbac将@Component取消 11 | */ 12 | //@Component 13 | public class TestAuthorizeConfigProvider implements AuthorizeConfigProvider { 14 | @Override 15 | public boolean config(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry config) { 16 | config.antMatchers(HttpMethod.POST,"/user/regist").permitAll(); 17 | return false; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | password: 123456 5 | username: root 6 | url: jdbc:mysql://127.0.0.1:3306/security-demo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false 7 | dbcp2: 8 | min-evictable-idle-time-millis: 180000 9 | test-on-borrow: true 10 | test-on-return: true 11 | test-while-idle: true 12 | validation-query: select 1 13 | tomcat: 14 | max-active: 100 15 | min-idle: 10 16 | jpa: 17 | generate-ddl: true 18 | show-sql: true 19 | 20 | session: 21 | store-type: none 22 | server: 23 | session: 24 | timeout: 600 25 | 26 | earthchen: 27 | security: 28 | browser: 29 | loginType: REDIRECT 30 | singInSuccessUrl: /manage.html 31 | registerPage: /signUp.html 32 | 33 | social: 34 | qq: 35 | app-id: 100550231 36 | app-secret: 4444444444444 37 | # 设置providerId 38 | providerId: callback.do 39 | # 将社交登录social前缀的/auth改为以下内容 40 | weixin: 41 | app-id: wxd99431bbff8305a0 42 | app-secret: 60f78681d063590a469f1b297feff3c4 43 | 44 | # 最终url为/social-auth/callback.do 45 | filterProcessesUrl: /qqLogin 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/src/main/resources/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | index 9 | 10 | -------------------------------------------------------------------------------- /test/src/main/resources/resources/signUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

Demo注册页

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 |
用户名:
密码:
22 | 23 | 24 |
27 |
28 | 29 | -------------------------------------------------------------------------------- /test/target/classes/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | datasource: 3 | driver-class-name: com.mysql.jdbc.Driver 4 | password: 123456 5 | username: root 6 | url: jdbc:mysql://127.0.0.1:3306/security-demo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false 7 | dbcp2: 8 | min-evictable-idle-time-millis: 180000 9 | test-on-borrow: true 10 | test-on-return: true 11 | test-while-idle: true 12 | validation-query: select 1 13 | tomcat: 14 | max-active: 100 15 | min-idle: 10 16 | jpa: 17 | generate-ddl: true 18 | show-sql: true 19 | 20 | session: 21 | store-type: none 22 | server: 23 | session: 24 | timeout: 600 25 | 26 | earthchen: 27 | security: 28 | browser: 29 | loginType: REDIRECT 30 | singInSuccessUrl: /manage.html 31 | registerPage: /signUp.html 32 | 33 | social: 34 | qq: 35 | app-id: 100550231 36 | app-secret: 4444444444444 37 | # 设置providerId 38 | providerId: callback.do 39 | # 将社交登录social前缀的/auth改为以下内容 40 | weixin: 41 | app-id: wxd99431bbff8305a0 42 | app-secret: 60f78681d063590a469f1b297feff3c4 43 | 44 | # 最终url为/social-auth/callback.do 45 | filterProcessesUrl: /qqLogin 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /test/target/classes/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | index 9 | 10 | -------------------------------------------------------------------------------- /test/target/classes/resources/signUp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 登录 6 | 7 | 8 |

Demo注册页

9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 |
用户名:
密码:
22 | 23 | 24 |
27 |
28 | 29 | --------------------------------------------------------------------------------