Commit dcfbf6e6c20b271e319a19b9fdc384781f282f16
1 parent
2a582f6f
Revert "Recopie de l'exemple d'OAuth"
This reverts commit 34526d9216c3f643f81cfc0ebd17333576f6b9d9. This reverts commit 2a582f6fc8488591e1b7570c92744e84a6253b27.
Showing
10 changed files
with
22 additions
and
316 deletions
Show diff stats
.gitignore
etunicorn-server.iml
@@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
5 | <output-test url="file://$MODULE_DIR$/target/test-classes" /> | 5 | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
6 | <content url="file://$MODULE_DIR$"> | 6 | <content url="file://$MODULE_DIR$"> |
7 | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | 7 | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
8 | - <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
9 | <excludeFolder url="file://$MODULE_DIR$/target" /> | 8 | <excludeFolder url="file://$MODULE_DIR$/target" /> |
10 | </content> | 9 | </content> |
11 | <orderEntry type="inheritedJdk" /> | 10 | <orderEntry type="inheritedJdk" /> |
@@ -29,90 +28,8 @@ | @@ -29,90 +28,8 @@ | ||
29 | <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" /> | 28 | <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" /> |
30 | <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" /> | 29 | <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" /> |
31 | <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.6.RELEASE" level="project" /> | 30 | <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.6.RELEASE" level="project" /> |
32 | - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.6" level="project" /> | ||
33 | - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.6" level="project" /> | ||
34 | - <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.6" level="project" /> | ||
35 | - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-rest-webmvc:2.5.7.RELEASE" level="project" /> | ||
36 | - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-rest-core:2.5.7.RELEASE" level="project" /> | ||
37 | - <orderEntry type="library" name="Maven: org.springframework.hateoas:spring-hateoas:0.20.0.RELEASE" level="project" /> | ||
38 | - <orderEntry type="library" name="Maven: org.springframework.plugin:spring-plugin-core:1.2.0.RELEASE" level="project" /> | ||
39 | - <orderEntry type="library" name="Maven: org.atteo:evo-inflector:1.2.1" level="project" /> | ||
40 | - <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.22" level="project" /> | ||
41 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:1.4.4.RELEASE" level="project" /> | ||
42 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:1.4.4.RELEASE" level="project" /> | ||
43 | - <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.9" level="project" /> | ||
44 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.4.4.RELEASE" level="project" /> | ||
45 | - <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.11" level="project" /> | ||
46 | - <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:8.5.11" level="project" /> | ||
47 | - <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:4.3.6.RELEASE" level="project" /> | ||
48 | - <orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.0.11.Final" level="project" /> | ||
49 | - <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" /> | ||
50 | - <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" /> | ||
51 | - <orderEntry type="library" name="Maven: org.javassist:javassist:3.20.0-GA" level="project" /> | ||
52 | - <orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" /> | ||
53 | - <orderEntry type="library" name="Maven: org.jboss:jandex:2.0.0.Final" level="project" /> | ||
54 | - <orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" /> | ||
55 | - <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" /> | ||
56 | - <orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" /> | ||
57 | - <orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.0.11.Final" level="project" /> | ||
58 | - <orderEntry type="library" name="Maven: javax.transaction:javax.transaction-api:1.2" level="project" /> | ||
59 | - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.10.7.RELEASE" level="project" /> | ||
60 | - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.12.7.RELEASE" level="project" /> | ||
61 | - <orderEntry type="library" name="Maven: org.springframework:spring-orm:4.3.6.RELEASE" level="project" /> | ||
62 | - <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.6.RELEASE" level="project" /> | ||
63 | - <orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.3.6.RELEASE" level="project" /> | ||
64 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:1.4.4.RELEASE" level="project" /> | ||
65 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:1.4.4.RELEASE" level="project" /> | ||
66 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:1.4.4.RELEASE" level="project" /> | ||
67 | - <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" /> | ||
68 | - <orderEntry type="library" name="Maven: org.assertj:assertj-core:2.5.0" level="project" /> | ||
69 | - <orderEntry type="library" name="Maven: org.mockito:mockito-core:1.10.19" level="project" /> | ||
70 | - <orderEntry type="library" scope="RUNTIME" name="Maven: org.objenesis:objenesis:2.1" level="project" /> | ||
71 | - <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> | ||
72 | - <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" /> | ||
73 | - <orderEntry type="library" name="Maven: org.skyscreamer:jsonassert:1.3.0" level="project" /> | ||
74 | - <orderEntry type="library" name="Maven: org.json:json:20140107" level="project" /> | ||
75 | - <orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.6.RELEASE" level="project" /> | ||
76 | - <orderEntry type="library" name="Maven: org.springframework:spring-test:4.3.6.RELEASE" level="project" /> | ||
77 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-security:1.4.4.RELEASE" level="project" /> | ||
78 | - <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.6.RELEASE" level="project" /> | ||
79 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-config:4.1.4.RELEASE" level="project" /> | ||
80 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-web:4.1.4.RELEASE" level="project" /> | ||
81 | - <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.6.RELEASE" level="project" /> | ||
82 | - <orderEntry type="library" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" /> | ||
83 | - <orderEntry type="library" name="Maven: net.minidev:json-smart:2.2.1" level="project" /> | ||
84 | - <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" /> | ||
85 | - <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" /> | ||
86 | - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" /> | ||
87 | - <orderEntry type="library" name="Maven: com.h2database:h2:1.4.193" level="project" /> | ||
88 | - <orderEntry type="library" name="Maven: org.springframework.security.oauth:spring-security-oauth2:2.0.12.RELEASE" level="project" /> | ||
89 | - <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.6.RELEASE" level="project" /> | ||
90 | - <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" level="project" /> | ||
91 | <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.6.RELEASE" level="project" /> | 31 | <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.6.RELEASE" level="project" /> |
92 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:4.1.4.RELEASE" level="project" /> | ||
93 | - <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" /> | ||
94 | - <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" /> | ||
95 | - <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.13" level="project" /> | ||
96 | - <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.13" level="project" /> | ||
97 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-rest:1.4.4.RELEASE" level="project" /> | ||
98 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.4.RELEASE" level="project" /> | ||
99 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" /> | ||
100 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.4.RELEASE" level="project" /> | ||
101 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:1.4.4.RELEASE" level="project" /> | ||
102 | - <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.9" level="project" /> | ||
103 | - <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.1.9" level="project" /> | ||
104 | - <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.22" level="project" /> | ||
105 | - <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.22" level="project" /> | ||
106 | - <orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.17" level="project" /> | ||
107 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:1.4.4.RELEASE" level="project" /> | ||
108 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:1.4.4.RELEASE" level="project" /> | ||
109 | - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.11" level="project" /> | ||
110 | - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.11" level="project" /> | ||
111 | - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.11" level="project" /> | ||
112 | - <orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:5.2.4.Final" level="project" /> | ||
113 | - <orderEntry type="library" name="Maven: javax.validation:validation-api:1.1.0.Final" level="project" /> | ||
114 | - <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.3" level="project" /> | ||
115 | - <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.6.RELEASE" level="project" /> | 32 | + <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.6.RELEASE" level="project" /> |
116 | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.6" level="project" /> | 33 | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.8.6" level="project" /> |
117 | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.6" level="project" /> | 34 | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.8.6" level="project" /> |
118 | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.6" level="project" /> | 35 | <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.8.6" level="project" /> |
@@ -124,6 +41,7 @@ | @@ -124,6 +41,7 @@ | ||
124 | <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.22" level="project" /> | 41 | <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.22" level="project" /> |
125 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:1.4.4.RELEASE" level="project" /> | 42 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-jpa:1.4.4.RELEASE" level="project" /> |
126 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:1.4.4.RELEASE" level="project" /> | 43 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-aop:1.4.4.RELEASE" level="project" /> |
44 | + <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.6.RELEASE" level="project" /> | ||
127 | <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.9" level="project" /> | 45 | <orderEntry type="library" name="Maven: org.aspectj:aspectjweaver:1.8.9" level="project" /> |
128 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.4.4.RELEASE" level="project" /> | 46 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:1.4.4.RELEASE" level="project" /> |
129 | <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.11" level="project" /> | 47 | <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:8.5.11" level="project" /> |
@@ -143,7 +61,9 @@ | @@ -143,7 +61,9 @@ | ||
143 | <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.10.7.RELEASE" level="project" /> | 61 | <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.10.7.RELEASE" level="project" /> |
144 | <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.12.7.RELEASE" level="project" /> | 62 | <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.12.7.RELEASE" level="project" /> |
145 | <orderEntry type="library" name="Maven: org.springframework:spring-orm:4.3.6.RELEASE" level="project" /> | 63 | <orderEntry type="library" name="Maven: org.springframework:spring-orm:4.3.6.RELEASE" level="project" /> |
64 | + <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" level="project" /> | ||
146 | <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.6.RELEASE" level="project" /> | 65 | <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.6.RELEASE" level="project" /> |
66 | + <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.6.RELEASE" level="project" /> | ||
147 | <orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.3.6.RELEASE" level="project" /> | 67 | <orderEntry type="library" name="Maven: org.springframework:spring-aspects:4.3.6.RELEASE" level="project" /> |
148 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:1.4.4.RELEASE" level="project" /> | 68 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-test:1.4.4.RELEASE" level="project" /> |
149 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:1.4.4.RELEASE" level="project" /> | 69 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-test:1.4.4.RELEASE" level="project" /> |
@@ -158,25 +78,11 @@ | @@ -158,25 +78,11 @@ | ||
158 | <orderEntry type="library" name="Maven: org.json:json:20140107" level="project" /> | 78 | <orderEntry type="library" name="Maven: org.json:json:20140107" level="project" /> |
159 | <orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.6.RELEASE" level="project" /> | 79 | <orderEntry type="library" name="Maven: org.springframework:spring-core:4.3.6.RELEASE" level="project" /> |
160 | <orderEntry type="library" name="Maven: org.springframework:spring-test:4.3.6.RELEASE" level="project" /> | 80 | <orderEntry type="library" name="Maven: org.springframework:spring-test:4.3.6.RELEASE" level="project" /> |
161 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-security:1.4.4.RELEASE" level="project" /> | ||
162 | - <orderEntry type="library" name="Maven: org.springframework:spring-aop:4.3.6.RELEASE" level="project" /> | ||
163 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-config:4.1.4.RELEASE" level="project" /> | ||
164 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-web:4.1.4.RELEASE" level="project" /> | ||
165 | - <orderEntry type="library" name="Maven: org.springframework:spring-expression:4.3.6.RELEASE" level="project" /> | ||
166 | <orderEntry type="library" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" /> | 81 | <orderEntry type="library" name="Maven: com.jayway.jsonpath:json-path:2.2.0" level="project" /> |
167 | <orderEntry type="library" name="Maven: net.minidev:json-smart:2.2.1" level="project" /> | 82 | <orderEntry type="library" name="Maven: net.minidev:json-smart:2.2.1" level="project" /> |
168 | <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" /> | 83 | <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" /> |
169 | <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" /> | 84 | <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" /> |
170 | <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" /> | 85 | <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" /> |
171 | <orderEntry type="library" name="Maven: com.h2database:h2:1.4.193" level="project" /> | 86 | <orderEntry type="library" name="Maven: com.h2database:h2:1.4.193" level="project" /> |
172 | - <orderEntry type="library" name="Maven: org.springframework.security.oauth:spring-security-oauth2:2.0.12.RELEASE" level="project" /> | ||
173 | - <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.6.RELEASE" level="project" /> | ||
174 | - <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" level="project" /> | ||
175 | - <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.6.RELEASE" level="project" /> | ||
176 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:4.1.4.RELEASE" level="project" /> | ||
177 | - <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" /> | ||
178 | - <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.10" level="project" /> | ||
179 | - <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.13" level="project" /> | ||
180 | - <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.13" level="project" /> | ||
181 | </component> | 87 | </component> |
182 | -</module> | ||
183 | \ No newline at end of file | 88 | \ No newline at end of file |
89 | +</module> |
pom.xml
@@ -27,10 +27,6 @@ | @@ -27,10 +27,6 @@ | ||
27 | <artifactId>spring-boot-starter-test</artifactId> | 27 | <artifactId>spring-boot-starter-test</artifactId> |
28 | </dependency> | 28 | </dependency> |
29 | <dependency> | 29 | <dependency> |
30 | - <groupId>org.springframework.boot</groupId> | ||
31 | - <artifactId>spring-boot-starter-security</artifactId> | ||
32 | - </dependency> | ||
33 | - <dependency> | ||
34 | <groupId>com.jayway.jsonpath</groupId> | 30 | <groupId>com.jayway.jsonpath</groupId> |
35 | <artifactId>json-path</artifactId> | 31 | <artifactId>json-path</artifactId> |
36 | </dependency> | 32 | </dependency> |
@@ -38,10 +34,6 @@ | @@ -38,10 +34,6 @@ | ||
38 | <groupId>com.h2database</groupId> | 34 | <groupId>com.h2database</groupId> |
39 | <artifactId>h2</artifactId> | 35 | <artifactId>h2</artifactId> |
40 | </dependency> | 36 | </dependency> |
41 | - <dependency> | ||
42 | - <groupId>org.springframework.security.oauth</groupId> | ||
43 | - <artifactId>spring-security-oauth2</artifactId> | ||
44 | - </dependency> | ||
45 | </dependencies> | 37 | </dependencies> |
46 | 38 | ||
47 | <properties> | 39 | <properties> |
src/main/java/etunicorn/CustomUserDetailsService.java deleted
@@ -1,76 +0,0 @@ | @@ -1,76 +0,0 @@ | ||
1 | -package etunicorn; | ||
2 | - | ||
3 | -import org.springframework.beans.factory.annotation.Autowired; | ||
4 | -import org.springframework.security.core.GrantedAuthority; | ||
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 | -import org.springframework.stereotype.Service; | ||
9 | - | ||
10 | -import java.util.Collection; | ||
11 | - | ||
12 | -/** | ||
13 | - * Created by geoffrey on 29/01/17. | ||
14 | - */ | ||
15 | -@Service | ||
16 | -public class CustomUserDetailsService implements UserDetailsService { | ||
17 | - | ||
18 | - private final PersonneRepository personneRepository; | ||
19 | - | ||
20 | - @Autowired | ||
21 | - public CustomUserDetailsService(PersonneRepository personneRepository) { | ||
22 | - this.personneRepository = personneRepository; | ||
23 | - } | ||
24 | - | ||
25 | - @Override | ||
26 | - public UserDetails loadUserByUsername(String login) throws UsernameNotFoundException { | ||
27 | - Personne personne = personneRepository.findByLogin(login); | ||
28 | - if (personne == null) { | ||
29 | - throw new UsernameNotFoundException(String.format("L'utilisateur %s n'existe pas !", login)); | ||
30 | - } | ||
31 | - return new PersonneRepositoryUserDetails(personne); | ||
32 | - } | ||
33 | - | ||
34 | - private final static class PersonneRepositoryUserDetails extends Personne implements UserDetails { | ||
35 | - | ||
36 | - public PersonneRepositoryUserDetails(Personne personne) { | ||
37 | - super(personne); | ||
38 | - } | ||
39 | - | ||
40 | - @Override | ||
41 | - public Collection<? extends GrantedAuthority> getAuthorities() { | ||
42 | - // return getRoles(); | ||
43 | - return null; | ||
44 | - } | ||
45 | - | ||
46 | - @Override | ||
47 | - public String getPassword() { | ||
48 | - return "test"; | ||
49 | - } | ||
50 | - | ||
51 | - @Override | ||
52 | - public String getUsername() { | ||
53 | - return getLogin(); | ||
54 | - } | ||
55 | - | ||
56 | - @Override | ||
57 | - public boolean isAccountNonExpired() { | ||
58 | - return true; | ||
59 | - } | ||
60 | - | ||
61 | - @Override | ||
62 | - public boolean isAccountNonLocked() { | ||
63 | - return true; | ||
64 | - } | ||
65 | - | ||
66 | - @Override | ||
67 | - public boolean isCredentialsNonExpired() { | ||
68 | - return true; | ||
69 | - } | ||
70 | - | ||
71 | - @Override | ||
72 | - public boolean isEnabled() { | ||
73 | - return true; | ||
74 | - } | ||
75 | - } | ||
76 | -} |
src/main/java/etunicorn/OAuth2ServerConfiguration.java deleted
@@ -1,87 +0,0 @@ | @@ -1,87 +0,0 @@ | ||
1 | -package etunicorn; | ||
2 | - | ||
3 | -import org.springframework.beans.factory.annotation.Autowired; | ||
4 | -import org.springframework.beans.factory.annotation.Qualifier; | ||
5 | -import org.springframework.context.annotation.Bean; | ||
6 | -import org.springframework.context.annotation.Configuration; | ||
7 | -import org.springframework.context.annotation.Primary; | ||
8 | -import org.springframework.security.authentication.AuthenticationManager; | ||
9 | -import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
10 | -import org.springframework.security.oauth2.config.annotation.configurers.ClientDetailsServiceConfigurer; | ||
11 | -import org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerConfigurerAdapter; | ||
12 | -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; | ||
13 | -import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; | ||
14 | -import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter; | ||
15 | -import org.springframework.security.oauth2.config.annotation.web.configurers.AuthorizationServerEndpointsConfigurer; | ||
16 | -import org.springframework.security.oauth2.config.annotation.web.configurers.ResourceServerSecurityConfigurer; | ||
17 | -import org.springframework.security.oauth2.provider.token.DefaultTokenServices; | ||
18 | -import org.springframework.security.oauth2.provider.token.TokenStore; | ||
19 | -import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore; | ||
20 | - | ||
21 | -/** | ||
22 | - * Created by geoffrey on 29/01/17. | ||
23 | - */ | ||
24 | -@Configuration | ||
25 | -public class OAuth2ServerConfiguration { | ||
26 | - private static final String RESOURCE_ID = "etunicornservice"; | ||
27 | - | ||
28 | - @Configuration | ||
29 | - @EnableResourceServer | ||
30 | - protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter { | ||
31 | - | ||
32 | - @Override | ||
33 | - public void configure(ResourceServerSecurityConfigurer resources) { | ||
34 | - resources.resourceId(RESOURCE_ID); | ||
35 | - } | ||
36 | - | ||
37 | - @Override | ||
38 | - public void configure(HttpSecurity http) throws Exception { | ||
39 | - http.authorizeRequests() | ||
40 | - .antMatchers("/personne").authenticated(); | ||
41 | - } | ||
42 | - } | ||
43 | - | ||
44 | - @Configuration | ||
45 | - @EnableAuthorizationServer | ||
46 | - protected static class AuthorizationServerConfiguration extends AuthorizationServerConfigurerAdapter { | ||
47 | - | ||
48 | - private TokenStore tokenStore = new InMemoryTokenStore(); | ||
49 | - | ||
50 | - @Autowired | ||
51 | - @Qualifier("authenticationManagerBean") | ||
52 | - private AuthenticationManager authenticationManager; | ||
53 | - | ||
54 | - @Autowired | ||
55 | - private CustomUserDetailsService userDetailsService; | ||
56 | - | ||
57 | - @Override | ||
58 | - public void configure(ClientDetailsServiceConfigurer clients) throws Exception { | ||
59 | - clients | ||
60 | - .inMemory() | ||
61 | - .withClient("clientapp") | ||
62 | - .authorizedGrantTypes("password", "refresh_token") | ||
63 | - .authorities("USER") | ||
64 | - .scopes("read", "write") | ||
65 | - .resourceIds(RESOURCE_ID) | ||
66 | - .secret("123456"); | ||
67 | - } | ||
68 | - | ||
69 | - @Override | ||
70 | - public void configure(AuthorizationServerEndpointsConfigurer endpoints) throws Exception { | ||
71 | - endpoints | ||
72 | - .tokenStore(this.tokenStore) | ||
73 | - .authenticationManager(this.authenticationManager) | ||
74 | - .userDetailsService(userDetailsService); | ||
75 | - } | ||
76 | - | ||
77 | - @Bean | ||
78 | - @Primary | ||
79 | - public DefaultTokenServices tokenServices() { | ||
80 | - DefaultTokenServices tokenServices = new DefaultTokenServices(); | ||
81 | - tokenServices.setSupportRefreshToken(true); | ||
82 | - tokenServices.setTokenStore(this.tokenStore); | ||
83 | - return tokenServices; | ||
84 | - } | ||
85 | - } | ||
86 | - | ||
87 | -} |
src/main/java/etunicorn/Personne.java
@@ -24,14 +24,6 @@ public class Personne { | @@ -24,14 +24,6 @@ public class Personne { | ||
24 | public Personne() { | 24 | public Personne() { |
25 | } | 25 | } |
26 | 26 | ||
27 | - public Personne(Personne personne) { | ||
28 | - super(); | ||
29 | - this.id = personne.getId(); | ||
30 | - this.carte = personne.getCarte(); | ||
31 | - this.naissance = personne.getNaissance(); | ||
32 | - this.login = personne.getLogin(); | ||
33 | - } | ||
34 | - | ||
35 | public int getId() { | 27 | public int getId() { |
36 | return id; | 28 | return id; |
37 | } | 29 | } |
src/main/java/etunicorn/PersonneController.java
@@ -5,11 +5,16 @@ import org.springframework.http.HttpStatus; | @@ -5,11 +5,16 @@ import org.springframework.http.HttpStatus; | ||
5 | import org.springframework.http.ResponseEntity; | 5 | import org.springframework.http.ResponseEntity; |
6 | import org.springframework.web.bind.annotation.PathVariable; | 6 | import org.springframework.web.bind.annotation.PathVariable; |
7 | import org.springframework.web.bind.annotation.RequestParam; | 7 | import org.springframework.web.bind.annotation.RequestParam; |
8 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
8 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
9 | 10 | ||
10 | import java.math.BigDecimal; | 11 | import java.math.BigDecimal; |
12 | +import java.text.DateFormat; | ||
13 | +import java.text.ParseException; | ||
14 | +import java.text.SimpleDateFormat; | ||
11 | import java.util.Date; | 15 | import java.util.Date; |
12 | import java.util.List; | 16 | import java.util.List; |
17 | +import java.util.Locale; | ||
13 | 18 | ||
14 | /** | 19 | /** |
15 | * Created by geoffrey on 28/01/17. | 20 | * Created by geoffrey on 28/01/17. |
@@ -0,0 +1,11 @@ | @@ -0,0 +1,11 @@ | ||
1 | +package etunicorn; | ||
2 | + | ||
3 | +import org.springframework.security.core.userdetails.UserDetails; | ||
4 | +import org.springframework.security.core.userdetails.UsernameNotFoundException; | ||
5 | + | ||
6 | +/** | ||
7 | + * Created by geoffrey on 29/01/17. | ||
8 | + */ | ||
9 | +public interface UserDetailsService { | ||
10 | + UserDetails loadByUsername(String s) throws UsernameNotFoundException; | ||
11 | +} |
src/main/java/etunicorn/WebSecurityConfiguration.java deleted
@@ -1,33 +0,0 @@ | @@ -1,33 +0,0 @@ | ||
1 | -package etunicorn; | ||
2 | - | ||
3 | -import org.springframework.beans.factory.annotation.Autowired; | ||
4 | -import org.springframework.context.annotation.Bean; | ||
5 | -import org.springframework.context.annotation.Configuration; | ||
6 | -import org.springframework.security.authentication.AuthenticationManager; | ||
7 | -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; | ||
8 | -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
9 | -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; | ||
10 | - | ||
11 | -/** | ||
12 | - * Created by geoffrey on 29/01/17. | ||
13 | - */ | ||
14 | -@Configuration | ||
15 | -@EnableWebSecurity | ||
16 | -public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { | ||
17 | - | ||
18 | - @Autowired | ||
19 | - private CustomUserDetailsService userDetailsService; | ||
20 | - | ||
21 | - @Override | ||
22 | - protected void configure(AuthenticationManagerBuilder auth) throws Exception { | ||
23 | - auth.userDetailsService(userDetailsService); | ||
24 | - } | ||
25 | - | ||
26 | - @Override | ||
27 | - @Bean | ||
28 | - public AuthenticationManager authenticationManagerBean() throws Exception { | ||
29 | - return super.authenticationManagerBean(); | ||
30 | - } | ||
31 | - | ||
32 | - | ||
33 | -} |
src/main/main.iml
@@ -25,8 +25,5 @@ | @@ -25,8 +25,5 @@ | ||
25 | <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" level="project" /> | 25 | <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" level="project" /> |
26 | <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.9" level="project" /> | 26 | <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.9" level="project" /> |
27 | <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.22" level="project" /> | 27 | <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.22" level="project" /> |
28 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:4.1.4.RELEASE" level="project" /> | ||
29 | - <orderEntry type="library" name="Maven: org.springframework.security:spring-security-config:4.1.4.RELEASE" level="project" /> | ||
30 | - <orderEntry type="library" name="Maven: org.springframework.security.oauth:spring-security-oauth2:2.0.12.RELEASE" level="project" /> | ||
31 | </component> | 28 | </component> |
32 | -</module> | ||
33 | \ No newline at end of file | 29 | \ No newline at end of file |
30 | +</module> |