├── src ├── main │ ├── resources │ │ ├── static │ │ │ └── vendor │ │ │ │ ├── font-awesome │ │ │ │ ├── less │ │ │ │ │ ├── extras.less │ │ │ │ │ ├── screen-reader.less │ │ │ │ │ ├── fixed-width.less │ │ │ │ │ ├── larger.less │ │ │ │ │ ├── list.less │ │ │ │ │ ├── core.less │ │ │ │ │ ├── stacked.less │ │ │ │ │ ├── font-awesome.less │ │ │ │ │ ├── bordered-pulled.less │ │ │ │ │ ├── spinning.less │ │ │ │ │ ├── rotated-flipped.less │ │ │ │ │ ├── path.less │ │ │ │ │ ├── animated.less │ │ │ │ │ └── mixins.less │ │ │ │ ├── fonts │ │ │ │ │ ├── FontAwesome.otf │ │ │ │ │ ├── fontawesome-webfont.eot │ │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ │ └── fontawesome-webfont.woff2 │ │ │ │ ├── scss │ │ │ │ │ ├── _fixed-width.scss │ │ │ │ │ ├── _screen-reader.scss │ │ │ │ │ ├── _larger.scss │ │ │ │ │ ├── _list.scss │ │ │ │ │ ├── _core.scss │ │ │ │ │ ├── font-awesome.scss │ │ │ │ │ ├── _stacked.scss │ │ │ │ │ ├── _bordered-pulled.scss │ │ │ │ │ ├── _spinning.scss │ │ │ │ │ ├── _rotated-flipped.scss │ │ │ │ │ ├── _path.scss │ │ │ │ │ ├── _animated.scss │ │ │ │ │ ├── _extras.scss │ │ │ │ │ └── _mixins.scss │ │ │ │ └── HELP-US-OUT.txt │ │ │ │ ├── datatables │ │ │ │ ├── images │ │ │ │ │ ├── favicon.ico │ │ │ │ │ ├── sort_asc.png │ │ │ │ │ ├── sort_both.png │ │ │ │ │ ├── sort_desc.png │ │ │ │ │ ├── Sorting icons.psd │ │ │ │ │ ├── sort_asc_disabled.png │ │ │ │ │ └── sort_desc_disabled.png │ │ │ │ ├── js │ │ │ │ │ ├── dataTables.bootstrap.min.js │ │ │ │ │ ├── dataTables.bootstrap4.min.js │ │ │ │ │ ├── dataTables.foundation.min.js │ │ │ │ │ ├── dataTables.material.min.js │ │ │ │ │ ├── dataTables.semanticui.min.js │ │ │ │ │ ├── dataTables.uikit.min.js │ │ │ │ │ ├── dataTables.jqueryui.min.js │ │ │ │ │ ├── dataTables.foundation.js │ │ │ │ │ ├── dataTables.jqueryui.js │ │ │ │ │ ├── dataTables.bootstrap.js │ │ │ │ │ ├── dataTables.uikit.js │ │ │ │ │ ├── dataTables.bootstrap4.js │ │ │ │ │ ├── dataTables.material.js │ │ │ │ │ └── dataTables.semanticui.js │ │ │ │ └── css │ │ │ │ │ ├── dataTables.material.min.css │ │ │ │ │ ├── dataTables.foundation.min.css │ │ │ │ │ ├── dataTables.semanticui.min.css │ │ │ │ │ ├── dataTables.material.css │ │ │ │ │ ├── dataTables.uikit.min.css │ │ │ │ │ ├── dataTables.semanticui.css │ │ │ │ │ ├── dataTables.foundation.css │ │ │ │ │ ├── dataTables.bootstrap.min.css │ │ │ │ │ ├── dataTables.uikit.css │ │ │ │ │ ├── dataTables.bootstrap4.min.css │ │ │ │ │ ├── dataTables.bootstrap.css │ │ │ │ │ └── dataTables.bootstrap4.css │ │ │ │ ├── bootstrap │ │ │ │ └── fonts │ │ │ │ │ ├── glyphicons-halflings-regular.eot │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ ├── glyphicons-halflings-regular.woff │ │ │ │ │ └── glyphicons-halflings-regular.woff2 │ │ │ │ ├── morrisjs │ │ │ │ └── morris.css │ │ │ │ ├── metisMenu │ │ │ │ ├── metisMenu.min.css │ │ │ │ ├── metisMenu.css │ │ │ │ ├── metisMenu.min.js │ │ │ │ └── metisMenu.js │ │ │ │ ├── sb-admin-2.min.js │ │ │ │ ├── datatables-plugins │ │ │ │ ├── dataTables.bootstrap.min.js │ │ │ │ └── dataTables.bootstrap.js │ │ │ │ ├── flot │ │ │ │ ├── jquery.flot.symbol.js │ │ │ │ ├── jquery.flot.resize.js │ │ │ │ ├── jquery.flot.threshold.js │ │ │ │ └── jquery.flot.crosshair.js │ │ │ │ ├── datatables-responsive │ │ │ │ ├── dataTables.responsive.scss │ │ │ │ └── dataTables.responsive.css │ │ │ │ ├── morris-data.js │ │ │ │ └── bootstrap-social │ │ │ │ ├── bootstrap-social.less │ │ │ │ └── bootstrap-social.scss │ │ ├── application.properties │ │ ├── sqlpatch │ │ │ ├── users.sql │ │ │ └── permission.sql │ │ └── templates │ │ │ ├── accessDenied.html │ │ │ └── login.html │ └── java │ │ └── com │ │ └── security │ │ └── annotation │ │ └── springbootsecuritypermission │ │ ├── secutiry │ │ ├── SecAuthEntryPoint.java │ │ ├── SecurityUserDetails.java │ │ └── SecurityUserDetailsService.java │ │ ├── utils │ │ ├── Workspace.java │ │ └── SecurityUtil.java │ │ ├── jpadata │ │ ├── UserRepository.java │ │ └── PermissionRepository.java │ │ ├── domain │ │ ├── Roles.java │ │ ├── BaseEntity.java │ │ ├── PermissionEntity.java │ │ └── UserEntity.java │ │ ├── aspect │ │ ├── PermissionCheck.java │ │ └── PermissionAspect.java │ │ ├── SpringBootSecurityPermissionApplication.java │ │ ├── controllers │ │ └── MainController.java │ │ └── SpringBootPermissionSecurity.java └── test │ └── java │ └── com │ └── security │ └── annotation │ └── springbootsecuritypermission │ └── SpringBootSecurityPermissionApplicationTests.java ├── .gitattributes ├── .mvn └── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties ├── .gitignore ├── pom.xml ├── mvnw.cmd └── README.md /src/main/resources/static/vendor/font-awesome/less/extras.less: -------------------------------------------------------------------------------- 1 | // Extras 2 | // -------------------------- 3 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | src/main/resources/static/* linguist-vendored 2 | *.js linguist-language=Java 3 | *.css linguist-language=Java -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.3/apache-maven-3.5.3-bin.zip 2 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/favicon.ico -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/sort_asc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/sort_asc.png -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/sort_both.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/sort_both.png -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/sort_desc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/sort_desc.png -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/screen-reader.less: -------------------------------------------------------------------------------- 1 | // Screen Readers 2 | // ------------------------- 3 | 4 | .sr-only { .sr-only(); } 5 | .sr-only-focusable { .sr-only-focusable(); } 6 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/Sorting icons.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/Sorting icons.psd -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/fonts/FontAwesome.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/font-awesome/fonts/FontAwesome.otf -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/fixed-width.less: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .@{fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_fixed-width.scss: -------------------------------------------------------------------------------- 1 | // Fixed Width Icons 2 | // ------------------------- 3 | .#{$fa-css-prefix}-fw { 4 | width: (18em / 14); 5 | text-align: center; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/secutiry/SecAuthEntryPoint.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.secutiry; 2 | 3 | public class SecAuthEntryPoint { 4 | } 5 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/sort_asc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/sort_asc_disabled.png -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables/images/sort_desc_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/datatables/images/sort_desc_disabled.png -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_screen-reader.scss: -------------------------------------------------------------------------------- 1 | // Screen Readers 2 | // ------------------------- 3 | 4 | .sr-only { @include sr-only(); } 5 | .sr-only-focusable { @include sr-only-focusable(); } 6 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/font-awesome/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Dilsh0d/spring-boot-security-permission/HEAD/src/main/resources/static/vendor/bootstrap/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/utils/Workspace.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.utils; 2 | 3 | public interface Workspace { 4 | String DASHBOARD = "Dashboard"; 5 | String EMPLOYEE = "Employee"; 6 | String PROJECT = "Project"; 7 | String TASK = "Task"; 8 | String TEAM = "Team"; 9 | } 10 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url= jdbc:postgresql://localhost:5434/permission 2 | spring.datasource.username=postgres 3 | spring.datasource.password=postgres 4 | 5 | spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect 6 | spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true 7 | spring.jpa.hibernate.ddl-auto=update 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | !.mvn/wrapper/maven-wrapper.jar 3 | 4 | ### STS ### 5 | .apt_generated 6 | .classpath 7 | .factorypath 8 | .project 9 | .settings 10 | .springBeans 11 | .sts4-cache 12 | 13 | ### IntelliJ IDEA ### 14 | .idea 15 | *.iws 16 | *.iml 17 | *.ipr 18 | 19 | ### NetBeans ### 20 | /nbproject/private/ 21 | /build/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/HELP-US-OUT.txt: -------------------------------------------------------------------------------- 1 | I hope you love Font Awesome. If you've found it useful, please do me a favor and check out my latest project, 2 | Fort Awesome (https://fortawesome.com). It makes it easy to put the perfect icons on your website. Choose from our awesome, 3 | comprehensive icon sets or copy and paste your own. 4 | 5 | Please. Check it out. 6 | 7 | -Dave Gandy 8 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/morrisjs/morris.css: -------------------------------------------------------------------------------- 1 | .morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0} 2 | .morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0} 3 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/larger.less: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .@{fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .@{fa-css-prefix}-2x { font-size: 2em; } 11 | .@{fa-css-prefix}-3x { font-size: 3em; } 12 | .@{fa-css-prefix}-4x { font-size: 4em; } 13 | .@{fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_larger.scss: -------------------------------------------------------------------------------- 1 | // Icon Sizes 2 | // ------------------------- 3 | 4 | /* makes the font 33% larger relative to the icon container */ 5 | .#{$fa-css-prefix}-lg { 6 | font-size: (4em / 3); 7 | line-height: (3em / 4); 8 | vertical-align: -15%; 9 | } 10 | .#{$fa-css-prefix}-2x { font-size: 2em; } 11 | .#{$fa-css-prefix}-3x { font-size: 3em; } 12 | .#{$fa-css-prefix}-4x { font-size: 4em; } 13 | .#{$fa-css-prefix}-5x { font-size: 5em; } 14 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/jpadata/UserRepository.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.jpadata; 2 | 3 | import com.security.annotation.springbootsecuritypermission.domain.UserEntity; 4 | import org.springframework.data.jpa.repository.JpaRepository; 5 | 6 | import java.util.Optional; 7 | 8 | public interface UserRepository extends JpaRepository { 9 | Optional findByUsername(String username); 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/domain/Roles.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.domain; 2 | 3 | public enum Roles { 4 | Admin("ROLE_ADMIN"), 5 | Pm("ROLE_PM"), 6 | TemaLead("ROLE_TEAM_LEAD"), 7 | User("ROLE_USER"); 8 | 9 | private String roleName; 10 | 11 | Roles(String roleName) { 12 | this.roleName = roleName; 13 | } 14 | 15 | public String getRoleName() { 16 | return roleName; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/list.less: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: @fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .@{fa-css-prefix}-li { 11 | position: absolute; 12 | left: -@fa-li-width; 13 | width: @fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.@{fa-css-prefix}-lg { 17 | left: (-@fa-li-width + (4em / 14)); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_list.scss: -------------------------------------------------------------------------------- 1 | // List Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-ul { 5 | padding-left: 0; 6 | margin-left: $fa-li-width; 7 | list-style-type: none; 8 | > li { position: relative; } 9 | } 10 | .#{$fa-css-prefix}-li { 11 | position: absolute; 12 | left: -$fa-li-width; 13 | width: $fa-li-width; 14 | top: (2em / 14); 15 | text-align: center; 16 | &.#{$fa-css-prefix}-lg { 17 | left: -$fa-li-width + (4em / 14); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/core.less: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_core.scss: -------------------------------------------------------------------------------- 1 | // Base Class Definition 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix} { 5 | display: inline-block; 6 | font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/sqlpatch/users.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO users(username,password, roles,create_date, last_in_date) 2 | VALUES ('admin','$2a$10$4KpRoCAm.WE4qAsPXua2PeoyQiDRGCiBxPjcrz5dbSNByV21wl7Zy','Admin',now(),now()),-- password same admin 3 | ('pm','$2a$10$4KpRoCAm.WE4qAsPXua2PeoyQiDRGCiBxPjcrz5dbSNByV21wl7Zy','Pm',now(),now()),-- password same pm 4 | ('team','$2a$10$mz3MP0LngBF8fOsZtXVl2OeUd3CZIb1pJaI0Qn8yTMzdyoKKAv.qe','TeamLead',now(),now()),-- password same team 5 | ('user','$2a$10$.9403m3G0u4nrOXbilGPC.FyIuWNQepHTnEVgwpt9dLwX6tuL1uyW','User',now(),now());-- password same user; -------------------------------------------------------------------------------- /src/test/java/com/security/annotation/springbootsecuritypermission/SpringBootSecurityPermissionApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class SpringBootSecurityPermissionApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/font-awesome.scss: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables"; 7 | @import "mixins"; 8 | @import "path"; 9 | @import "core"; 10 | @import "larger"; 11 | @import "fixed-width"; 12 | @import "list"; 13 | @import "bordered-pulled"; 14 | @import "animated"; 15 | @import "rotated-flipped"; 16 | @import "stacked"; 17 | @import "icons"; 18 | @import "screen-reader"; 19 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/aspect/PermissionCheck.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.aspect; 2 | 3 | import com.security.annotation.springbootsecuritypermission.domain.Roles; 4 | 5 | import java.lang.annotation.Retention; 6 | import java.lang.annotation.RetentionPolicy; 7 | 8 | @Retention(RetentionPolicy.RUNTIME) 9 | public @interface PermissionCheck { 10 | 11 | String[] workspace() default {}; 12 | 13 | boolean read() default false; 14 | 15 | boolean write() default false; 16 | 17 | boolean delete() default false; 18 | } 19 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/stacked.less: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .@{fa-css-prefix}-stack-1x, .@{fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .@{fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .@{fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .@{fa-css-prefix}-inverse { color: @fa-inverse; } 21 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/jpadata/PermissionRepository.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.jpadata; 2 | 3 | import com.security.annotation.springbootsecuritypermission.domain.PermissionEntity; 4 | import com.security.annotation.springbootsecuritypermission.domain.Roles; 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | 7 | import java.util.List; 8 | 9 | public interface PermissionRepository extends JpaRepository { 10 | List findByRolesAndWorkspaceIn(Roles roles,String... workspace); 11 | } 12 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_stacked.scss: -------------------------------------------------------------------------------- 1 | // Stacked Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-stack { 5 | position: relative; 6 | display: inline-block; 7 | width: 2em; 8 | height: 2em; 9 | line-height: 2em; 10 | vertical-align: middle; 11 | } 12 | .#{$fa-css-prefix}-stack-1x, .#{$fa-css-prefix}-stack-2x { 13 | position: absolute; 14 | left: 0; 15 | width: 100%; 16 | text-align: center; 17 | } 18 | .#{$fa-css-prefix}-stack-1x { line-height: inherit; } 19 | .#{$fa-css-prefix}-stack-2x { font-size: 2em; } 20 | .#{$fa-css-prefix}-inverse { color: $fa-inverse; } 21 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/font-awesome.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Font Awesome 4.6.3 by @davegandy - http://fontawesome.io - @fontawesome 3 | * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) 4 | */ 5 | 6 | @import "variables.less"; 7 | @import "mixins.less"; 8 | @import "path.less"; 9 | @import "core.less"; 10 | @import "larger.less"; 11 | @import "fixed-width.less"; 12 | @import "list.less"; 13 | @import "bordered-pulled.less"; 14 | @import "animated.less"; 15 | @import "rotated-flipped.less"; 16 | @import "stacked.less"; 17 | @import "icons.less"; 18 | @import "screen-reader.less"; 19 | -------------------------------------------------------------------------------- /src/main/resources/templates/accessDenied.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Access Denied 6 | 7 | 8 | 9 |
10 |
11 |
12 |
13 |

Access Denied

14 |
15 | 16 |
17 | 18 |
19 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/domain/BaseEntity.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.domain; 2 | 3 | import javax.persistence.GeneratedValue; 4 | import javax.persistence.GenerationType; 5 | import javax.persistence.Id; 6 | import javax.persistence.MappedSuperclass; 7 | import java.io.Serializable; 8 | 9 | @MappedSuperclass 10 | public class BaseEntity implements Serializable { 11 | 12 | @Id 13 | @GeneratedValue(strategy = GenerationType.IDENTITY) 14 | private Long id; 15 | 16 | public Long getId() { 17 | return id; 18 | } 19 | 20 | public void setId(Long id) { 21 | this.id = id; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/bordered-pulled.less: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em @fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .@{fa-css-prefix}-pull-left { float: left; } 11 | .@{fa-css-prefix}-pull-right { float: right; } 12 | 13 | .@{fa-css-prefix} { 14 | &.@{fa-css-prefix}-pull-left { margin-right: .3em; } 15 | &.@{fa-css-prefix}-pull-right { margin-left: .3em; } 16 | } 17 | 18 | /* Deprecated as of 4.4.0 */ 19 | .pull-right { float: right; } 20 | .pull-left { float: left; } 21 | 22 | .@{fa-css-prefix} { 23 | &.pull-left { margin-right: .3em; } 24 | &.pull-right { margin-left: .3em; } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/spinning.less: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .@{fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | @-webkit-keyframes fa-spin { 10 | 0% { 11 | -webkit-transform: rotate(0deg); 12 | transform: rotate(0deg); 13 | } 14 | 100% { 15 | -webkit-transform: rotate(359deg); 16 | transform: rotate(359deg); 17 | } 18 | } 19 | 20 | @keyframes fa-spin { 21 | 0% { 22 | -webkit-transform: rotate(0deg); 23 | transform: rotate(0deg); 24 | } 25 | 100% { 26 | -webkit-transform: rotate(359deg); 27 | transform: rotate(359deg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_bordered-pulled.scss: -------------------------------------------------------------------------------- 1 | // Bordered & Pulled 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-border { 5 | padding: .2em .25em .15em; 6 | border: solid .08em $fa-border-color; 7 | border-radius: .1em; 8 | } 9 | 10 | .#{$fa-css-prefix}-pull-left { float: left; } 11 | .#{$fa-css-prefix}-pull-right { float: right; } 12 | 13 | .#{$fa-css-prefix} { 14 | &.#{$fa-css-prefix}-pull-left { margin-right: .3em; } 15 | &.#{$fa-css-prefix}-pull-right { margin-left: .3em; } 16 | } 17 | 18 | /* Deprecated as of 4.4.0 */ 19 | .pull-right { float: right; } 20 | .pull-left { float: left; } 21 | 22 | .#{$fa-css-prefix} { 23 | &.pull-left { margin-right: .3em; } 24 | &.pull-right { margin-left: .3em; } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/rotated-flipped.less: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .@{fa-css-prefix}-rotate-90 { .fa-icon-rotate(90deg, 1); } 5 | .@{fa-css-prefix}-rotate-180 { .fa-icon-rotate(180deg, 2); } 6 | .@{fa-css-prefix}-rotate-270 { .fa-icon-rotate(270deg, 3); } 7 | 8 | .@{fa-css-prefix}-flip-horizontal { .fa-icon-flip(-1, 1, 0); } 9 | .@{fa-css-prefix}-flip-vertical { .fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .@{fa-css-prefix}-rotate-90, 15 | :root .@{fa-css-prefix}-rotate-180, 16 | :root .@{fa-css-prefix}-rotate-270, 17 | :root .@{fa-css-prefix}-flip-horizontal, 18 | :root .@{fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_spinning.scss: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .#{$fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | @-webkit-keyframes fa-spin { 10 | 0% { 11 | -webkit-transform: rotate(0deg); 12 | transform: rotate(0deg); 13 | } 14 | 100% { 15 | -webkit-transform: rotate(359deg); 16 | transform: rotate(359deg); 17 | } 18 | } 19 | 20 | @keyframes fa-spin { 21 | 0% { 22 | -webkit-transform: rotate(0deg); 23 | transform: rotate(0deg); 24 | } 25 | 100% { 26 | -webkit-transform: rotate(359deg); 27 | transform: rotate(359deg); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_rotated-flipped.scss: -------------------------------------------------------------------------------- 1 | // Rotated & Flipped Icons 2 | // ------------------------- 3 | 4 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } 5 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } 6 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } 7 | 8 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } 9 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } 10 | 11 | // Hook for IE8-9 12 | // ------------------------- 13 | 14 | :root .#{$fa-css-prefix}-rotate-90, 15 | :root .#{$fa-css-prefix}-rotate-180, 16 | :root .#{$fa-css-prefix}-rotate-270, 17 | :root .#{$fa-css-prefix}-flip-horizontal, 18 | :root .#{$fa-css-prefix}-flip-vertical { 19 | filter: none; 20 | } 21 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/metisMenu/metisMenu.min.css: -------------------------------------------------------------------------------- 1 | /* 2 | * metismenu - v1.1.3 3 | * Easy menu jQuery plugin for Twitter Bootstrap 3 4 | * https://github.com/onokumus/metisMenu 5 | * 6 | * Made by Osman Nuri Okumus 7 | * Under MIT License 8 | */ 9 | 10 | .arrow{float:right;line-height:1.42857}.glyphicon.arrow:before{content:"\e079"}.active>a>.glyphicon.arrow:before{content:"\e114"}.fa.arrow:before{content:"\f104"}.active>a>.fa.arrow:before{content:"\f107"}.plus-times{float:right}.fa.plus-times:before{content:"\f067"}.active>a>.fa.plus-times{filter:progid:DXImageTransform.Microsoft.BasicImage(rotation=1);-webkit-transform:rotate(45deg);-moz-transform:rotate(45deg);-ms-transform:rotate(45deg);-o-transform:rotate(45deg);transform:rotate(45deg)}.plus-minus{float:right}.fa.plus-minus:before{content:"\f067"}.active>a>.fa.plus-minus:before{content:"\f068"} -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/path.less: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('@{fa-font-path}/fontawesome-webfont.eot?v=@{fa-version}'); 7 | src: url('@{fa-font-path}/fontawesome-webfont.eot?#iefix&v=@{fa-version}') format('embedded-opentype'), 8 | url('@{fa-font-path}/fontawesome-webfont.woff2?v=@{fa-version}') format('woff2'), 9 | url('@{fa-font-path}/fontawesome-webfont.woff?v=@{fa-version}') format('woff'), 10 | url('@{fa-font-path}/fontawesome-webfont.ttf?v=@{fa-version}') format('truetype'), 11 | url('@{fa-font-path}/fontawesome-webfont.svg?v=@{fa-version}#fontawesomeregular') format('svg'); 12 | // src: url('@{fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/sb-admin-2.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Start Bootstrap - SB Admin 2 v3.3.7+1 (http://startbootstrap.com/template-overviews/sb-admin-2) 3 | * Copyright 2013-2016 Start Bootstrap 4 | * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) 5 | */ 6 | $(function(){$("#side-menu").metisMenu()}),$(function(){$(window).bind("load resize",function(){var i=50,n=this.window.innerWidth>0?this.window.innerWidth:this.screen.width;n<768?($("div.navbar-collapse").addClass("collapse"),i=100):$("div.navbar-collapse").removeClass("collapse");var e=(this.window.innerHeight>0?this.window.innerHeight:this.screen.height)-1;e-=i,e<1&&(e=1),e>i&&$("#page-wrapper").css("min-height",e+"px")});for(var i=window.location,n=$("ul.nav a").filter(function(){return this.href==i}).addClass("active").parent();;){if(!n.is("li"))break;n=n.parent().addClass("in").parent()}}); -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_path.scss: -------------------------------------------------------------------------------- 1 | /* FONT PATH 2 | * -------------------------- */ 3 | 4 | @font-face { 5 | font-family: 'FontAwesome'; 6 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?v=#{$fa-version}'); 7 | src: url('#{$fa-font-path}/fontawesome-webfont.eot?#iefix&v=#{$fa-version}') format('embedded-opentype'), 8 | url('#{$fa-font-path}/fontawesome-webfont.woff2?v=#{$fa-version}') format('woff2'), 9 | url('#{$fa-font-path}/fontawesome-webfont.woff?v=#{$fa-version}') format('woff'), 10 | url('#{$fa-font-path}/fontawesome-webfont.ttf?v=#{$fa-version}') format('truetype'), 11 | url('#{$fa-font-path}/fontawesome-webfont.svg?v=#{$fa-version}#fontawesomeregular') format('svg'); 12 | // src: url('#{$fa-font-path}/FontAwesome.otf') format('opentype'); // used when developing fonts 13 | font-weight: normal; 14 | font-style: normal; 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/SpringBootSecurityPermissionApplication.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.EnableAspectJAutoProxy; 6 | import org.springframework.data.jpa.repository.config.EnableJpaRepositories; 7 | 8 | @SpringBootApplication 9 | @EnableAspectJAutoProxy 10 | @EnableJpaRepositories(basePackages = "com.security.annotation.springbootsecuritypermission.jpadata") 11 | public class SpringBootSecurityPermissionApplication { 12 | 13 | public static void main(String[] args) { 14 | SpringApplication.run(SpringBootSecurityPermissionApplication.class, args); 15 | System.out.println("Our project run with http://localhost:8080"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/animated.less: -------------------------------------------------------------------------------- 1 | // Animated Icons 2 | // -------------------------- 3 | 4 | .@{fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | .@{fa-css-prefix}-pulse { 10 | -webkit-animation: fa-spin 1s infinite steps(8); 11 | animation: fa-spin 1s infinite steps(8); 12 | } 13 | 14 | @-webkit-keyframes fa-spin { 15 | 0% { 16 | -webkit-transform: rotate(0deg); 17 | transform: rotate(0deg); 18 | } 19 | 100% { 20 | -webkit-transform: rotate(359deg); 21 | transform: rotate(359deg); 22 | } 23 | } 24 | 25 | @keyframes fa-spin { 26 | 0% { 27 | -webkit-transform: rotate(0deg); 28 | transform: rotate(0deg); 29 | } 30 | 100% { 31 | -webkit-transform: rotate(359deg); 32 | transform: rotate(359deg); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_animated.scss: -------------------------------------------------------------------------------- 1 | // Spinning Icons 2 | // -------------------------- 3 | 4 | .#{$fa-css-prefix}-spin { 5 | -webkit-animation: fa-spin 2s infinite linear; 6 | animation: fa-spin 2s infinite linear; 7 | } 8 | 9 | .#{$fa-css-prefix}-pulse { 10 | -webkit-animation: fa-spin 1s infinite steps(8); 11 | animation: fa-spin 1s infinite steps(8); 12 | } 13 | 14 | @-webkit-keyframes fa-spin { 15 | 0% { 16 | -webkit-transform: rotate(0deg); 17 | transform: rotate(0deg); 18 | } 19 | 100% { 20 | -webkit-transform: rotate(359deg); 21 | transform: rotate(359deg); 22 | } 23 | } 24 | 25 | @keyframes fa-spin { 26 | 0% { 27 | -webkit-transform: rotate(0deg); 28 | transform: rotate(0deg); 29 | } 30 | 100% { 31 | -webkit-transform: rotate(359deg); 32 | transform: rotate(359deg); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/resources/sqlpatch/permission.sql: -------------------------------------------------------------------------------- 1 | INSERT INTO "permission"(roles, workspace,"read","write","delete") VALUES 2 | ('Admin', 'Dashboard', true, true, true), 3 | ('Admin', 'Employee', true, true, true), 4 | ('Admin', 'Project', true, true, true), 5 | ('Admin', 'Task', true, true, true), 6 | ('Admin', 'Team', true, true, true), 7 | 8 | ('Pm', 'Dashboard', true, false, false), 9 | ('Pm', 'Employee', true, false, false), 10 | ('Pm', 'Project', true, true, true), 11 | ('Pm', 'Task', true, true, true), 12 | ('Pm', 'Team', true, false, false), 13 | 14 | ('TemaLead', 'Dashboard', true, false, false), 15 | ('TemaLead', 'Employee', true, true, true), 16 | ('TemaLead', 'Project', true, false, false), 17 | ('TemaLead', 'Task', true, false, false), 18 | ('TemaLead', 'Team', true, true, true), 19 | 20 | ('User', 'Dashboard', false, false, false), 21 | ('User', 'Employee', true, false, false), 22 | ('User', 'Project', true, false, false), 23 | ('User', 'Task', true, true, false), 24 | ('User', 'Team', true, false, false); -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/secutiry/SecurityUserDetails.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.secutiry; 2 | 3 | import com.security.annotation.springbootsecuritypermission.domain.Roles; 4 | import org.springframework.security.core.GrantedAuthority; 5 | import org.springframework.security.core.authority.AuthorityUtils; 6 | import org.springframework.security.core.userdetails.UserDetails; 7 | 8 | import java.util.Collection; 9 | 10 | public class SecurityUserDetails extends org.springframework.security.core.userdetails.User { 11 | 12 | private Long id; 13 | private Roles roles; 14 | 15 | public SecurityUserDetails(Long id,String userName,String password,Roles roles) { 16 | super(userName,password, AuthorityUtils.createAuthorityList(roles.getRoleName())); 17 | this.id = id; 18 | this.roles = roles; 19 | } 20 | 21 | public Long getId() { 22 | return id; 23 | } 24 | 25 | public Roles getRoles() { 26 | return roles; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/utils/SecurityUtil.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.utils; 2 | 3 | import com.security.annotation.springbootsecuritypermission.secutiry.SecurityUserDetails; 4 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; 5 | import org.springframework.security.core.context.SecurityContextHolder; 6 | 7 | public class SecurityUtil { 8 | public static SecurityUserDetails getUser() { 9 | UsernamePasswordAuthenticationToken authentication = (UsernamePasswordAuthenticationToken) 10 | SecurityContextHolder.getContext().getAuthentication(); 11 | if (authentication.getPrincipal() instanceof SecurityUserDetails) { 12 | return (SecurityUserDetails) authentication.getPrincipal(); 13 | } 14 | return null; 15 | } 16 | 17 | public static Long getUserId() { 18 | SecurityUserDetails user = getUser(); 19 | if (user != null) { 20 | return user.getId(); 21 | } 22 | return null; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/secutiry/SecurityUserDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.secutiry; 2 | 3 | import com.security.annotation.springbootsecuritypermission.domain.UserEntity; 4 | import com.security.annotation.springbootsecuritypermission.jpadata.UserRepository; 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.Service; 10 | 11 | import java.util.Optional; 12 | 13 | public class SecurityUserDetailsService implements UserDetailsService { 14 | 15 | @Autowired 16 | private UserRepository userRepository; 17 | 18 | @Override 19 | public UserDetails loadUserByUsername(String username) { 20 | Optional optional = userRepository.findByUsername(username); 21 | if (optional.isPresent()) { 22 | UserEntity user = optional.get(); 23 | return new SecurityUserDetails(user.getId(),user.getUsername(),user.getPassword(),user.getRoles()); 24 | } 25 | throw new UsernameNotFoundException(username); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/metisMenu/metisMenu.css: -------------------------------------------------------------------------------- 1 | /* 2 | * metismenu - v1.1.3 3 | * Easy menu jQuery plugin for Twitter Bootstrap 3 4 | * https://github.com/onokumus/metisMenu 5 | * 6 | * Made by Osman Nuri Okumus 7 | * Under MIT License 8 | */ 9 | .arrow { 10 | float: right; 11 | line-height: 1.42857; 12 | } 13 | 14 | .glyphicon.arrow:before { 15 | content: "\e079"; 16 | } 17 | 18 | .active > a > .glyphicon.arrow:before { 19 | content: "\e114"; 20 | } 21 | 22 | 23 | /* 24 | * Require Font-Awesome 25 | * http://fortawesome.github.io/Font-Awesome/ 26 | */ 27 | 28 | 29 | .fa.arrow:before { 30 | content: "\f104"; 31 | } 32 | 33 | .active > a > .fa.arrow:before { 34 | content: "\f107"; 35 | } 36 | 37 | .plus-times { 38 | float: right; 39 | } 40 | 41 | .fa.plus-times:before { 42 | content: "\f067"; 43 | } 44 | 45 | .active > a > .fa.plus-times { 46 | filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=1); 47 | -webkit-transform: rotate(45deg); 48 | -moz-transform: rotate(45deg); 49 | -ms-transform: rotate(45deg); 50 | -o-transform: rotate(45deg); 51 | transform: rotate(45deg); 52 | } 53 | 54 | .plus-minus { 55 | float: right; 56 | } 57 | 58 | .fa.plus-minus:before { 59 | content: "\f067"; 60 | } 61 | 62 | .active > a > .fa.plus-minus:before { 63 | content: "\f068"; 64 | } -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_extras.scss: -------------------------------------------------------------------------------- 1 | /* EXTRAS 2 | * -------------------------- */ 3 | 4 | /* Stacked and layered icon */ 5 | 6 | /* Animated rotating icon */ 7 | .#{$fa-css-prefix}-spin { 8 | -webkit-animation: spin 2s infinite linear; 9 | -moz-animation: spin 2s infinite linear; 10 | -o-animation: spin 2s infinite linear; 11 | animation: spin 2s infinite linear; 12 | } 13 | 14 | @-moz-keyframes spin { 15 | 0% { -moz-transform: rotate(0deg); } 16 | 100% { -moz-transform: rotate(359deg); } 17 | } 18 | @-webkit-keyframes spin { 19 | 0% { -webkit-transform: rotate(0deg); } 20 | 100% { -webkit-transform: rotate(359deg); } 21 | } 22 | @-o-keyframes spin { 23 | 0% { -o-transform: rotate(0deg); } 24 | 100% { -o-transform: rotate(359deg); } 25 | } 26 | @-ms-keyframes spin { 27 | 0% { -ms-transform: rotate(0deg); } 28 | 100% { -ms-transform: rotate(359deg); } 29 | } 30 | @keyframes spin { 31 | 0% { transform: rotate(0deg); } 32 | 100% { transform: rotate(359deg); } 33 | } 34 | 35 | 36 | // Icon rotations & flipping 37 | // ------------------------- 38 | 39 | .#{$fa-css-prefix}-rotate-90 { @include fa-icon-rotate(90deg, 1); } 40 | .#{$fa-css-prefix}-rotate-180 { @include fa-icon-rotate(180deg, 2); } 41 | .#{$fa-css-prefix}-rotate-270 { @include fa-icon-rotate(270deg, 3); } 42 | 43 | .#{$fa-css-prefix}-flip-horizontal { @include fa-icon-flip(-1, 1, 0); } 44 | .#{$fa-css-prefix}-flip-vertical { @include fa-icon-flip(1, -1, 2); } 45 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/domain/PermissionEntity.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.domain; 2 | 3 | import javax.persistence.*; 4 | 5 | @Entity 6 | @Table(name = "permission") 7 | public class PermissionEntity extends BaseEntity{ 8 | 9 | @Column(name = "roles") 10 | @Enumerated(EnumType.STRING) 11 | private Roles roles; 12 | 13 | @Basic 14 | private String workspace; 15 | 16 | @Basic 17 | private Boolean read = Boolean.FALSE; 18 | 19 | @Basic 20 | private Boolean write = Boolean.FALSE; 21 | 22 | @Basic 23 | private Boolean delete = Boolean.FALSE; 24 | 25 | 26 | public Roles getRoles() { 27 | return roles; 28 | } 29 | 30 | public void setRoles(Roles roles) { 31 | this.roles = roles; 32 | } 33 | 34 | public String getWorkspace() { 35 | return workspace; 36 | } 37 | 38 | public void setWorkspace(String workspace) { 39 | this.workspace = workspace; 40 | } 41 | 42 | public Boolean getRead() { 43 | return read; 44 | } 45 | 46 | public void setRead(Boolean read) { 47 | this.read = read; 48 | } 49 | 50 | public Boolean getWrite() { 51 | return write; 52 | } 53 | 54 | public void setWrite(Boolean write) { 55 | this.write = write; 56 | } 57 | 58 | public Boolean getDelete() { 59 | return delete; 60 | } 61 | 62 | public void setDelete(Boolean delete) { 63 | this.delete = delete; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/controllers/MainController.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.controllers; 2 | 3 | import com.security.annotation.springbootsecuritypermission.aspect.PermissionCheck; 4 | import com.security.annotation.springbootsecuritypermission.utils.Workspace; 5 | import org.springframework.stereotype.Controller; 6 | import org.springframework.web.bind.annotation.GetMapping; 7 | 8 | @Controller 9 | public class MainController { 10 | 11 | @GetMapping({"/","/login"}) 12 | public String login() { 13 | return "login"; 14 | } 15 | 16 | @GetMapping("dashboard") 17 | @PermissionCheck(workspace = {Workspace.DASHBOARD},read = true) 18 | public String dashboard() { 19 | return "dashboard"; 20 | } 21 | 22 | @GetMapping("projects") 23 | @PermissionCheck(workspace = {Workspace.PROJECT},read = true) 24 | public String projects() { 25 | return "projects"; 26 | } 27 | 28 | @GetMapping("tasks") 29 | @PermissionCheck(workspace = {Workspace.TASK},read = true) 30 | public String tasks() { 31 | return "tasks"; 32 | } 33 | 34 | @GetMapping("teams") 35 | @PermissionCheck(workspace = {Workspace.TEAM},read = true) 36 | public String teams() { 37 | return "teams"; 38 | } 39 | 40 | @GetMapping("employees") 41 | @PermissionCheck(workspace = {Workspace.EMPLOYEE},read = true) 42 | public String employees() { 43 | return "employees"; 44 | } 45 | 46 | @GetMapping("accessDenied") 47 | public String accessDenied() { 48 | return "accessDenied"; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/com/security/annotation/springbootsecuritypermission/domain/UserEntity.java: -------------------------------------------------------------------------------- 1 | package com.security.annotation.springbootsecuritypermission.domain; 2 | 3 | import javax.persistence.*; 4 | import java.util.Date; 5 | 6 | @Entity 7 | @Table(name = "users") 8 | public class UserEntity extends BaseEntity { 9 | 10 | @Column(name = "username",length = 64,nullable = false,unique = true) 11 | private String username; 12 | 13 | @Column(name = "password",length = 64,nullable = false) 14 | private String password; 15 | 16 | @Column(name = "roles") 17 | @Enumerated(value = EnumType.STRING) 18 | private Roles roles; 19 | 20 | @Column(name = "createDate") 21 | private Date createDate; 22 | 23 | @Column(name = "lastInDate") 24 | private Date lastInDate; 25 | 26 | public String getUsername() { 27 | return username; 28 | } 29 | 30 | public void setUsername(String username) { 31 | this.username = username; 32 | } 33 | 34 | public String getPassword() { 35 | return password; 36 | } 37 | 38 | public void setPassword(String password) { 39 | this.password = password; 40 | } 41 | 42 | public Roles getRoles() { 43 | return roles; 44 | } 45 | 46 | public void setRoles(Roles roles) { 47 | this.roles = roles; 48 | } 49 | 50 | public Date getCreateDate() { 51 | return createDate; 52 | } 53 | 54 | public void setCreateDate(Date createDate) { 55 | this.createDate = createDate; 56 | } 57 | 58 | public Date getLastInDate() { 59 | return lastInDate; 60 | } 61 | 62 | public void setLastInDate(Date lastInDate) { 63 | this.lastInDate = lastInDate; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | .fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal @fa-font-size-base/@fa-line-height-base FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | 14 | .fa-icon-rotate(@degrees, @rotation) { 15 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation})"; 16 | -webkit-transform: rotate(@degrees); 17 | -ms-transform: rotate(@degrees); 18 | transform: rotate(@degrees); 19 | } 20 | 21 | .fa-icon-flip(@horiz, @vert, @rotation) { 22 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=@{rotation}, mirror=1)"; 23 | -webkit-transform: scale(@horiz, @vert); 24 | -ms-transform: scale(@horiz, @vert); 25 | transform: scale(@horiz, @vert); 26 | } 27 | 28 | 29 | // Only display content to screen readers. A la Bootstrap 4. 30 | // 31 | // See: http://a11yproject.com/posts/how-to-hide-content/ 32 | 33 | .sr-only() { 34 | position: absolute; 35 | width: 1px; 36 | height: 1px; 37 | padding: 0; 38 | margin: -1px; 39 | overflow: hidden; 40 | clip: rect(0,0,0,0); 41 | border: 0; 42 | } 43 | 44 | // Use in conjunction with .sr-only to only display content when it's focused. 45 | // 46 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 47 | // 48 | // Credit: HTML5 Boilerplate 49 | 50 | .sr-only-focusable() { 51 | &:active, 52 | &:focus { 53 | position: static; 54 | width: auto; 55 | height: auto; 56 | margin: 0; 57 | overflow: visible; 58 | clip: auto; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/metisMenu/metisMenu.min.js: -------------------------------------------------------------------------------- 1 | /* 2 | * metismenu - v1.1.3 3 | * Easy menu jQuery plugin for Twitter Bootstrap 3 4 | * https://github.com/onokumus/metisMenu 5 | * 6 | * Made by Osman Nuri Okumus 7 | * Under MIT License 8 | */ 9 | !function(a,b,c){function d(b,c){this.element=a(b),this.settings=a.extend({},f,c),this._defaults=f,this._name=e,this.init()}var e="metisMenu",f={toggle:!0,doubleTapToGo:!1};d.prototype={init:function(){var b=this.element,d=this.settings.toggle,f=this;this.isIE()<=9?(b.find("li.active").has("ul").children("ul").collapse("show"),b.find("li").not(".active").has("ul").children("ul").collapse("hide")):(b.find("li.active").has("ul").children("ul").addClass("collapse in"),b.find("li").not(".active").has("ul").children("ul").addClass("collapse")),f.settings.doubleTapToGo&&b.find("li.active").has("ul").children("a").addClass("doubleTapToGo"),b.find("li").has("ul").children("a").on("click."+e,function(b){return b.preventDefault(),f.settings.doubleTapToGo&&f.doubleTapToGo(a(this))&&"#"!==a(this).attr("href")&&""!==a(this).attr("href")?(b.stopPropagation(),void(c.location=a(this).attr("href"))):(a(this).parent("li").toggleClass("active").children("ul").collapse("toggle"),void(d&&a(this).parent("li").siblings().removeClass("active").children("ul.in").collapse("hide")))})},isIE:function(){for(var a,b=3,d=c.createElement("div"),e=d.getElementsByTagName("i");d.innerHTML="",e[0];)return b>4?b:a},doubleTapToGo:function(a){var b=this.element;return a.hasClass("doubleTapToGo")?(a.removeClass("doubleTapToGo"),!0):a.parent().children("ul").length?(b.find(".doubleTapToGo").removeClass("doubleTapToGo"),a.addClass("doubleTapToGo"),!1):void 0},remove:function(){this.element.off("."+e),this.element.removeData(e)}},a.fn[e]=function(b){return this.each(function(){var c=a(this);c.data(e)&&c.data(e).remove(),c.data(e,new d(this,b))}),this}}(jQuery,window,document); -------------------------------------------------------------------------------- /src/main/resources/static/vendor/font-awesome/scss/_mixins.scss: -------------------------------------------------------------------------------- 1 | // Mixins 2 | // -------------------------- 3 | 4 | @mixin fa-icon() { 5 | display: inline-block; 6 | font: normal normal normal #{$fa-font-size-base}/#{$fa-line-height-base} FontAwesome; // shortening font declaration 7 | font-size: inherit; // can't have font-size inherit on line above, so need to override 8 | text-rendering: auto; // optimizelegibility throws things off #1094 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | 12 | } 13 | 14 | @mixin fa-icon-rotate($degrees, $rotation) { 15 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation})"; 16 | -webkit-transform: rotate($degrees); 17 | -ms-transform: rotate($degrees); 18 | transform: rotate($degrees); 19 | } 20 | 21 | @mixin fa-icon-flip($horiz, $vert, $rotation) { 22 | -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=#{$rotation}, mirror=1)"; 23 | -webkit-transform: scale($horiz, $vert); 24 | -ms-transform: scale($horiz, $vert); 25 | transform: scale($horiz, $vert); 26 | } 27 | 28 | 29 | // Only display content to screen readers. A la Bootstrap 4. 30 | // 31 | // See: http://a11yproject.com/posts/how-to-hide-content/ 32 | 33 | @mixin sr-only { 34 | position: absolute; 35 | width: 1px; 36 | height: 1px; 37 | padding: 0; 38 | margin: -1px; 39 | overflow: hidden; 40 | clip: rect(0,0,0,0); 41 | border: 0; 42 | } 43 | 44 | // Use in conjunction with .sr-only to only display content when it's focused. 45 | // 46 | // Useful for "Skip to main content" links; see http://www.w3.org/TR/2013/NOTE-WCAG20-TECHS-20130905/G1 47 | // 48 | // Credit: HTML5 Boilerplate 49 | 50 | @mixin sr-only-focusable { 51 | &:active, 52 | &:focus { 53 | position: static; 54 | width: auto; 55 | height: auto; 56 | margin: 0; 57 | overflow: visible; 58 | clip: auto; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/resources/static/vendor/datatables-plugins/dataTables.bootstrap.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | DataTables Bootstrap 3 integration 3 | ©2011-2014 SpryMedia Ltd - datatables.net/license 4 | */ 5 | (function(){var f=function(c,b){c.extend(!0,b.defaults,{dom:"<'row'<'col-sm-6'l><'col-sm-6'f>><'row'<'col-sm-12'tr>><'row'<'col-sm-6'i><'col-sm-6'p>>",renderer:"bootstrap"});c.extend(b.ext.classes,{sWrapper:"dataTables_wrapper form-inline dt-bootstrap",sFilterInput:"form-control input-sm",sLengthSelect:"form-control input-sm"});b.ext.renderer.pageButton.bootstrap=function(g,f,p,k,h,l){var q=new b.Api(g),r=g.oClasses,i=g.oLanguage.oPaginate,d,e,o=function(b,f){var j,m,n,a,k=function(a){a.preventDefault(); 6 | c(a.currentTarget).hasClass("disabled")||q.page(a.data.action).draw(!1)};j=0;for(m=f.length;j",{"class":r.sPageButton+" "+ 7 | e,"aria-controls":g.sTableId,tabindex:g.iTabIndex,id:0===p&&"string"===typeof a?g.sTableId+"_"+a:null}).append(c("",{href:"#"}).html(d)).appendTo(b),g.oApi._fnBindAction(n,{action:a},k))}};o(c(f).empty().html('