Project

General

Profile

« Previous | Next » 

Revision 34651

Added by Eri Katsari over 9 years ago

Deleting wrong import

View differences:

modules/uoa-oauth-server/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3
    <parent>
4
        <groupId>eu.dnetlib</groupId>
5
        <artifactId>dnet-parent</artifactId>
6
        <version>1.0.0-SNAPSHOT</version>
7
        <relativePath></relativePath>
8
    </parent>
9
    <modelVersion>4.0.0</modelVersion>
10
    <groupId>eu.dnetlib</groupId>
11
    <artifactId>uoa-oauth-server</artifactId>
12
    <version>1.0.0-SNAPSHOT</version>
13
    <packaging>war</packaging>
14

  
15

  
16
    <properties>
17
        <servlet.port>8081</servlet.port>
18
        <mujina-idp.version>3.1.0</mujina-idp.version>
19
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
20
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
21
        <!-- all the versions in the oa-aas project -->
22
        <dropwizard.version>0.4.2</dropwizard.version>
23
        <flyway.version>2.1.1</flyway.version>
24
        <hsqldb.version>2.2.8</hsqldb.version>
25
        <junit.version>4.10</junit.version>
26
        <tomcat-jdbc.version>7.0.29</tomcat-jdbc.version>
27
        <spring.version>3.2.7.RELEASE</spring.version>
28
        <spring-security.version>3.2.7.RELEASE</spring-security.version>
29
        <spring-data-commons-core.version>1.3.0</spring-data-commons-core.version>
30
        <openjpa.version>2.2.0</openjpa.version>
31
        <commons-lang.version>2.6</commons-lang.version>
32
        <commons-io.version>2.0.1</commons-io.version>
33
        <jersey.version>1.12</jersey.version>
34
        <commons-codec.version>1.4</commons-codec.version>
35
        <coin-test.version>2.8.1</coin-test.version>
36
        <servlet-api.version>3.0.1</servlet-api.version>
37
        <slf4j.version>1.7.2</slf4j.version>
38
        <commons-validator.version>1.4.0</commons-validator.version>
39
        <hibernate-validator.version>4.3.0.Final</hibernate-validator.version>
40
        <spring-security-opensaml.version>4.0.0</spring-security-opensaml.version>
41
        <spring-data-jpa.version>1.1.0.RELEASE</spring-data-jpa.version>
42
        <javax-inject.version>1</javax-inject.version>
43
        <mockito.version>1.9.0</mockito.version>
44
        <jackson.version>1.9.2</jackson.version>
45
        <logback.version>1.0.6</logback.version>
46
        <jetty-maven-plugin.version>8.1.4.v20120524</jetty-maven-plugin.version>
47
        <selenium.version>2.32.0</selenium.version>
48
        <cglib.version>2.2.2</cglib.version>
49
        <jstl.version>1.2</jstl.version>
50
        <jsp.version>2.1</jsp.version>
51
        <mysql.version>5.1.20</mysql.version>
52
        <coin-api.version>3.11.0</coin-api.version>
53
        <project.version>1.3.6-SNAPSHOT</project.version>
54

  
55
    </properties>
56
    <repositories>
57
        <repository>
58
            <snapshots>
59
                <enabled>false</enabled>
60
            </snapshots>
61
            <releases>
62
                <enabled>true</enabled>
63
                <updatePolicy>never</updatePolicy>
64
            </releases>
65
            <id>openconext-releases</id>
66
            <name>OpenConext public releases repository</name>
67
            <url>https://build.surfconext.nl/repository/public/releases</url>
68
        </repository>
69
        <repository>
70
            <snapshots>
71
                <enabled>true</enabled>
72
            </snapshots>
73
            <releases>
74
                <enabled>false</enabled>
75
                <updatePolicy>never</updatePolicy>
76
            </releases>
77
            <id>openconext-snapshots</id>
78
            <name>OpenConext public snapshots repository</name>
79
            <url>https://build.surfconext.nl/repository/public/snapshots</url>
80
        </repository>
81
    </repositories>
82

  
83
    <pluginRepositories>
84
        <pluginRepository>
85
            <snapshots>
86
                <enabled>false</enabled>
87
            </snapshots>
88
            <releases>
89
                <enabled>true</enabled>
90
                <updatePolicy>never</updatePolicy>
91
            </releases>
92
            <id>openconext-releases</id>
93
            <name>OpenConext public releases repository</name>
94
            <url>https://build.surfconext.nl/repository/public/releases</url>
95
        </pluginRepository>
96
    </pluginRepositories>
97

  
98

  
99
    <dependencies>
100

  
101
        <dependency>
102
            <groupId>com.unboundid</groupId>
103
            <artifactId>unboundid-ldapsdk</artifactId>
104
            <version>2.3.6</version>
105
        </dependency>
106

  
107
        <dependency>
108
            <groupId>nl.surfnet.apis</groupId>
109
            <artifactId>apis-authorization-server</artifactId>
110
            <version>1.3.6-SNAPSHOT</version>
111
        </dependency>
112

  
113
        <dependency>
114
            <groupId>com.sun.jersey</groupId>
115
            <artifactId>jersey-servlet</artifactId>
116
            <version>${jersey.version}</version>
117
        </dependency>
118

  
119

  
120
        <dependency>
121
            <groupId>org.apache.tomcat</groupId>
122
            <artifactId>tomcat-jdbc</artifactId>
123
            <version>7.0.29</version>
124
        </dependency>
125
        <dependency>
126
            <groupId>javax.servlet</groupId>
127
            <artifactId>javax.servlet-api</artifactId>
128
            <version>3.1.0</version>
129
        </dependency>
130
        <dependency>
131
            <groupId>javax.servlet.jsp.jstl</groupId>
132
            <artifactId>jstl-api</artifactId>
133
            <version>1.2</version>
134
        </dependency>
135

  
136

  
137
        <dependency>
138
            <groupId>javax.servlet</groupId>
139
            <artifactId>jsp-api</artifactId>
140
            <version>2.0</version>
141
        </dependency>
142

  
143
        <dependency>
144
            <groupId>mysql</groupId>
145
            <artifactId>mysql-connector-java</artifactId>
146
            <version>5.1.20</version>
147
        </dependency>
148
        <dependency>
149
            <groupId>postgresql</groupId>
150
            <artifactId>postgresql</artifactId>
151
            <version>9.1-901.jdbc4</version>
152
        </dependency>
153

  
154
        <dependency>
155
            <groupId>com.sun.jersey.contribs</groupId>
156
            <artifactId>jersey-spring</artifactId>
157
            <version>1.12</version>
158
            <exclusions>
159
                <exclusion>
160
                    <groupId>org.springframework</groupId>
161
                    <artifactId>spring</artifactId>
162
                </exclusion>
163
                <exclusion>
164
                    <groupId>org.springframework</groupId>
165
                    <artifactId>spring-core</artifactId>
166
                </exclusion>
167
                <exclusion>
168
                    <groupId>org.springframework</groupId>
169
                    <artifactId>spring-web</artifactId>
170
                </exclusion>
171
                <exclusion>
172
                    <groupId>org.springframework</groupId>
173
                    <artifactId>spring-beans</artifactId>
174
                </exclusion>
175
                <exclusion>
176
                    <groupId>org.springframework</groupId>
177
                    <artifactId>spring-context</artifactId>
178
                </exclusion>
179
                <exclusion>
180
                    <groupId>org.springframework</groupId>
181
                    <artifactId>spring-aop</artifactId>
182
                </exclusion>
183
            </exclusions>
184
        </dependency>
185

  
186

  
187
        <dependency>
188
            <groupId>com.sun.jersey</groupId>
189
            <artifactId>jersey-client</artifactId>
190
            <version>1.12</version>
191
        </dependency>
192

  
193

  
194
        <!-- SPRING DEPENDENCIES -->
195

  
196
        <dependency>
197
            <groupId>org.surfnet.coin</groupId>
198
            <artifactId>spring-security-opensaml</artifactId>
199
            <version>${spring-security-opensaml.version}</version>
200
        </dependency>
201
        <dependency>
202
            <groupId>org.springframework.data</groupId>
203
            <artifactId>spring-data-jpa</artifactId>
204
            <version>${spring-data-jpa.version}</version>
205
        </dependency>
206
        <dependency>
207
            <groupId>org.springframework</groupId>
208
            <artifactId>spring-beans</artifactId>
209
            <version>${spring.version}</version>
210
        </dependency>
211
        <dependency>
212
            <groupId>org.springframework</groupId>
213
            <artifactId>spring-web</artifactId>
214
            <version>${spring.version}</version>
215
        </dependency>
216
        <dependency>
217
            <groupId>org.springframework</groupId>
218
            <artifactId>spring-webmvc</artifactId>
219
            <version>${spring.version}</version>
220
        </dependency>
221
        <dependency>
222
            <groupId>org.springframework</groupId>
223
            <artifactId>spring-jdbc</artifactId>
224
            <version>${spring.version}</version>
225
        </dependency>
226
        <dependency>
227
            <groupId>org.springframework</groupId>
228
            <artifactId>spring-context</artifactId>
229
            <version>${spring.version}</version>
230
        </dependency>
231

  
232
        <dependency>
233
            <groupId>org.springframework</groupId>
234
            <artifactId>spring-core</artifactId>
235
            <version>${spring.version}</version>
236
        </dependency>
237
        <dependency>
238
            <groupId>org.springframework</groupId>
239
            <artifactId>spring-tx</artifactId>
240
            <version>${spring.version}</version>
241
        </dependency>
242
        <dependency>
243
            <groupId>org.springframework</groupId>
244
            <artifactId>spring-orm</artifactId>
245
            <version>${spring.version}</version>
246
        </dependency>
247
        <dependency>
248
            <groupId>org.springframework</groupId>
249
            <artifactId>spring-test</artifactId>
250
            <version>${spring.version}</version>
251
            <scope>test</scope>
252
        </dependency>
253
        <dependency>
254
            <groupId>org.springframework.data</groupId>
255
            <artifactId>spring-data-commons-core</artifactId>
256
            <version>1.3.0.RELEASE</version>
257
        </dependency>
258

  
259

  
260
        <!-- LDAP -->
261
        <dependency>
262
            <groupId>xml-apis</groupId>
263
            <artifactId>xml-apis</artifactId>
264
            <version>1.4.01</version>
265
        </dependency>
266

  
267
        <!-- SPRING CONFIG -->
268
        <dependency>
269
            <groupId>cglib</groupId>
270
            <artifactId>cglib</artifactId>
271
            <version>${cglib.version}</version>
272
        </dependency>
273
        <dependency>
274
            <groupId>javax.inject</groupId>
275
            <artifactId>javax.inject</artifactId>
276
            <version>${javax-inject.version}</version>
277
        </dependency>
278
        <dependency>
279
            <groupId>org.hibernate</groupId>
280
            <artifactId>hibernate-validator</artifactId>
281
            <version>${hibernate-validator.version}</version>
282
        </dependency>
283
        <dependency>
284
            <groupId>com.yammer.dropwizard</groupId>
285
            <artifactId>dropwizard-auth</artifactId>
286
            <version>${dropwizard.version}</version>
287
        </dependency>
288
        <dependency>
289
            <groupId>com.yammer.dropwizard</groupId>
290
            <artifactId>dropwizard-views</artifactId>
291
            <version>${dropwizard.version}</version>
292
        </dependency>
293
        <dependency>
294
            <groupId>com.yammer.dropwizard</groupId>
295
            <artifactId>dropwizard-client</artifactId>
296
            <version>${dropwizard.version}</version>
297
        </dependency>
298

  
299

  
300
        <!-- JUNIT -->
301
        <dependency>
302
            <groupId>junit</groupId>
303
            <artifactId>junit</artifactId>
304
            <version>${junit.version}</version>
305
            <scope>test</scope>
306
        </dependency>
307

  
308

  
309
        <!-- Begin Selenium -->
310
        <dependency>
311
            <groupId>org.seleniumhq.selenium</groupId>
312
            <artifactId>selenium-firefox-driver</artifactId>
313
            <version>2.32.0</version>
314
            <scope>test</scope>
315
        </dependency>
316
        <dependency>
317
            <groupId>org.seleniumhq.selenium</groupId>
318
            <artifactId>selenium-support</artifactId>
319
            <version>2.32.0</version>
320
            <scope>test</scope>
321
        </dependency>
322
        <dependency>
323
            <groupId>org.seleniumhq.selenium</groupId>
324
            <artifactId>selenium-htmlunit-driver</artifactId>
325
            <version>2.32.0</version>
326
            <scope>test</scope>
327
        </dependency>
328
        <!-- End Selenium -->
329

  
330

  
331
        <dependency>
332
            <groupId>org.apache.httpcomponents</groupId>
333
            <artifactId>httpclient</artifactId>
334
            <version>4.2</version>
335
            <classifier>tests</classifier>
336
            <scope>test</scope>
337
        </dependency>
338

  
339
        <dependency>
340
            <groupId>nl.surfnet.apis</groupId>
341
            <artifactId>apis-resource-server-library</artifactId>
342
            <version>1.3.6-SNAPSHOT</version>
343
        </dependency>
344

  
345

  
346
        <!-- LOGGING -->
347

  
348
        <!-- <dependency> -->
349
        <!-- <groupId>ch.qos.logback</groupId> -->
350
        <!-- <artifactId>logback-classic</artifactId> -->
351
        <!-- <version>1.3.6-SNAPSHOT</version> -->
352
        <!-- </dependency> -->
353
        <dependency>
354
            <groupId>org.slf4j</groupId>
355
            <artifactId>log4j-over-slf4j</artifactId>
356
            <version>${slf4j.version}</version>
357
        </dependency>
358
        <dependency>
359
            <groupId>org.slf4j</groupId>
360
            <artifactId>jcl-over-slf4j</artifactId>
361
            <version>${slf4j.version}</version>
362
        </dependency>
363
        <dependency>
364
            <groupId>org.slf4j</groupId>
365
            <artifactId>jul-to-slf4j</artifactId>
366
            <version>${slf4j.version}</version>
367
        </dependency>
368
        <!-- <dependency> -->
369
        <!-- <groupId>commons-logging</groupId> -->
370
        <!-- <artifactId>commons-logging</artifactId> -->
371
        <!-- <version> ${slf4j.version}</version> -->
372
        <!-- </dependency> -->
373
        <!-- <dependency> -->
374
        <!-- <groupId>log4j</groupId> -->
375
        <!-- <artifactId>log4j</artifactId> -->
376
        <!-- <version> ${slf4j.version}</version> -->
377
        <!-- </dependency> -->
378
    </dependencies>
379

  
380
    <profiles>
381

  
382
        <!-- Profile for integration tests. Enable with -Pintegration This profile
383
            enables the maven failsafe plugin with its standard configuration. This means
384
            that test classes **TestIT.java will be run and **Test.java will be skipped.
385
            Prior to run ning the tests, a Jetty container is started by the jetty-maven-plugin. -->
386
        <profile>
387
            <id>integration</id>
388
            <activation>
389
                <activeByDefault>false</activeByDefault>
390
                <property>
391
                    <name>integration</name>
392
                </property>
393
            </activation>
394
            <build>
395
                <plugins>
396
                    <plugin>
397
                        <artifactId>maven-failsafe-plugin</artifactId>
398
                        <version>2.12</version>
399
                        <executions>
400
                            <execution>
401
                                <goals>
402
                                    <goal>integration-test</goal>
403
                                    <goal>verify</goal>
404
                                </goals>
405
                            </execution>
406
                        </executions>
407
                    </plugin>
408
                    <plugin>
409
                        <groupId>org.mortbay.jetty</groupId>
410
                        <artifactId>jetty-maven-plugin</artifactId>
411
                        <version>8.1.4.v20120524</version>
412
                        <!-- 8.1.4.v20120524 -->
413
                        <configuration>
414
                            <scanIntervalSeconds>0</scanIntervalSeconds>
415
                            <webAppConfig>
416
                                <contextPath>/</contextPath>
417
                                <extraClasspath>${basedir}/src/test/resources/</extraClasspath>
418
                            </webAppConfig>
419
                            <connectors>
420
                                <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
421
                                    <port>${servlet.port}</port>
422
                                    <maxIdleTime>60000</maxIdleTime>
423
                                </connector>
424
                            </connectors>
425
                            <daemon>true</daemon>
426
                            <scanIntervalSeconds>0</scanIntervalSeconds>
427
                            <stopKey>foo</stopKey>
428
                            <stopPort>9966</stopPort>
429
                            <contextXml>${basedir}/src/test/resources/jetty-context.xml</contextXml>
430
                        </configuration>
431
                        <executions>
432
                            <execution>
433
                                <id>start-jetty</id>
434
                                <phase>pre-integration-test</phase>
435
                                <goals>
436
                                    <goal>run</goal>
437
                                </goals>
438
                            </execution>
439
                            <execution>
440
                                <id>stop-jetty</id>
441
                                <phase>post-integration-test</phase>
442
                                <goals>
443
                                    <goal>stop</goal>
444
                                </goals>
445
                            </execution>
446
                        </executions>
447
                    </plugin>
448
                </plugins>
449
            </build>
450
        </profile>
451

  
452
        <!-- extra profile to use a headless selenium driver instead of default
453
            (firefox). -->
454
        <profile>
455
            <id>selenium-headless</id>
456
            <activation>
457
                <activeByDefault>false</activeByDefault>
458
            </activation>
459
            <properties>
460
                <selenium.webdriver>htmlunit</selenium.webdriver>
461
            </properties>
462
        </profile>
463

  
464
    </profiles>
465

  
466

  
467
    <build>
468
        <!--<finalName>oauth</finalName>-->
469
        <plugins>
470

  
471
            <!-- Specific jetty-maven-plugin configuration for running Jetty during
472
                development. None of its goals are run in a normal build lifecycle. -->
473
            <plugin>
474
                <groupId>org.mortbay.jetty</groupId>
475
                <artifactId>jetty-maven-plugin</artifactId>
476
                <version>8.1.4.v20120524</version>
477
                <dependencies>
478
                    <dependency>
479
                        <groupId>org.surfnet.coin</groupId>
480
                        <artifactId>mujina-idp</artifactId>
481
                        <type>war</type>
482
                        <version>3.1.0</version>
483
                    </dependency>
484
                    <dependency>
485
                        <groupId>nl.surfnet.apis</groupId>
486
                        <artifactId>apis-openconext-mock-war</artifactId>
487
                        <type>war</type>
488
                        <version>1.3.6-SNAPSHOT</version>
489
                    </dependency>
490
                </dependencies>
491
                <configuration>
492
                    <contextHandlers>
493
                        <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
494
                            <contextPath>/mujina-idp</contextPath>
495
                            <war>
496
                                ${settings.localRepository}/org/surfnet/coin/mujina-idp/3.1.0/mujina-idp-3.1.0.war
497
                            </war>
498
                            <extraClasspath>${basedir}/src/test/resources/</extraClasspath>
499
                        </contextHandler>
500
                        <contextHandler implementation="org.eclipse.jetty.webapp.WebAppContext">
501
                            <contextPath>/openconext-mock</contextPath>
502
                            <war>
503
                                ${settings.localRepository}/nl/surfnet/apis/apis-openconext-mock-war/1.3.6-SNAPSHOT/apis-openconext-mock-war-1.3.6-SNAPSHOT.war
504
                            </war>
505
                            <extraClasspath>${basedir}/src/test/resources/</extraClasspath>
506
                        </contextHandler>
507
                    </contextHandlers>
508

  
509
                    <webAppConfig>
510
                        <contextPath>/</contextPath>
511
                        <extraClasspath>${basedir}/src/test/resources/</extraClasspath>
512
                    </webAppConfig>
513
                    <connectors>
514
                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
515
                            <port>${servlet.port}</port>
516
                            <host>0.0.0.0</host>
517
                        </connector>
518
                    </connectors>
519
                    <reload>manual</reload>
520
                    <stopKey>stopauthserver</stopKey>
521
                    <stopPort>9280</stopPort>
522
                    <useTestClasspath>true</useTestClasspath>
523
                    <contextXml>${basedir}/src/test/resources/jetty-context.xml</contextXml>
524
                </configuration>
525
            </plugin>
526
        </plugins>
527
    </build>
528
</project>
modules/uoa-oauth-server/uoa-oauth-server.iml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
  <component name="FacetManager">
4
    <facet type="web" name="Web">
5
      <configuration>
6
        <descriptors>
7
          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" />
8
        </descriptors>
9
        <webroots>
10
          <root url="file://$MODULE_DIR$/src/main/webapp" relative="/" />
11
        </webroots>
12
        <sourceRoots>
13
          <root url="file://$MODULE_DIR$/src/main/java" />
14
          <root url="file://$MODULE_DIR$/src/main/resources" />
15
        </sourceRoots>
16
      </configuration>
17
    </facet>
18
    <facet type="Spring" name="Spring">
19
      <configuration />
20
    </facet>
21
  </component>
22
  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_6" inherit-compiler-output="false">
23
    <output url="file://$MODULE_DIR$/target/classes" />
24
    <output-test url="file://$MODULE_DIR$/target/test-classes" />
25
    <content url="file://$MODULE_DIR$">
26
      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
27
      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
28
      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
29
      <sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
30
      <excludeFolder url="file://$MODULE_DIR$/target" />
31
    </content>
32
    <orderEntry type="inheritedJdk" />
33
    <orderEntry type="sourceFolder" forTests="false" />
34
    <orderEntry type="library" name="Spring Integration-4.0.3" level="project" />
35
    <orderEntry type="library" name="Maven: com.unboundid:unboundid-ldapsdk:2.3.6" level="project" />
36
    <orderEntry type="library" name="Maven: nl.surfnet.apis:apis-authorization-server:1.3.6-SNAPSHOT" level="project" />
37
    <orderEntry type="library" name="Maven: nl.surfnet.apis:apis-resource-server-library:1.3.6-SNAPSHOT" level="project" />
38
    <orderEntry type="library" name="Maven: com.sun.jersey:jersey-json:1.12" level="project" />
39
    <orderEntry type="library" name="Maven: org.codehaus.jettison:jettison:1.1" level="project" />
40
    <orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
41
    <orderEntry type="library" name="Maven: com.sun.xml.bind:jaxb-impl:2.2.3-1" level="project" />
42
    <orderEntry type="library" name="Maven: javax.xml.bind:jaxb-api:2.2.2" level="project" />
43
    <orderEntry type="library" name="Maven: javax.xml.stream:stax-api:1.0-2" level="project" />
44
    <orderEntry type="library" name="Maven: javax.activation:activation:1.1" level="project" />
45
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.2" level="project" />
46
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mapper-asl:1.9.2" level="project" />
47
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-jaxrs:1.9.2" level="project" />
48
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-xc:1.9.2" level="project" />
49
    <orderEntry type="library" name="Maven: com.sun.jersey:jersey-core:1.12" level="project" />
50
    <orderEntry type="library" name="Maven: com.sun.jersey:jersey-client:1.12" level="project" />
51
    <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-mrbean:1.9.2" level="project" />
52
    <orderEntry type="library" name="Maven: commons-lang:commons-lang:2.6" level="project" />
53
    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.4" level="project" />
54
    <orderEntry type="library" name="Maven: commons-validator:commons-validator:1.4.0" level="project" />
55
    <orderEntry type="library" name="Maven: commons-beanutils:commons-beanutils:1.8.3" level="project" />
56
    <orderEntry type="library" name="Maven: commons-digester:commons-digester:1.8" level="project" />
57
    <orderEntry type="library" name="Maven: org.springframework:spring-context:3.2.7.RELEASE" level="project" />
58
    <orderEntry type="library" name="Maven: org.springframework:spring-aop:3.2.7.RELEASE" level="project" />
59
    <orderEntry type="library" name="Maven: aopalliance:aopalliance:1.0" level="project" />
60
    <orderEntry type="library" name="Maven: org.springframework:spring-beans:3.2.7.RELEASE" level="project" />
61
    <orderEntry type="library" name="Maven: org.springframework:spring-core:3.2.7.RELEASE" level="project" />
62
    <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
63
    <orderEntry type="library" name="Maven: org.springframework:spring-expression:3.2.7.RELEASE" level="project" />
64
    <orderEntry type="library" name="Maven: javax.inject:javax.inject:1" level="project" />
65
    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.2" level="project" />
66
    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.6.1" level="project" />
67
    <orderEntry type="library" name="Maven: cglib:cglib:2.2.2" level="project" />
68
    <orderEntry type="library" name="Maven: asm:asm:3.3.1" level="project" />
69
    <orderEntry type="library" name="Maven: org.apache.openjpa:openjpa:2.2.0" level="project" />
70
    <orderEntry type="library" name="Maven: commons-collections:commons-collections:3.2.1" level="project" />
71
    <orderEntry type="library" name="Maven: net.sourceforge.serp:serp:1.13.1" level="project" />
72
    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.10" level="project" />
73
    <orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-jms_1.1_spec:1.1.1" level="project" />
74
    <orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1" level="project" />
75
    <orderEntry type="library" name="Maven: commons-pool:commons-pool:1.5.4" level="project" />
76
    <orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-jpa_2.0_spec:1.1" level="project" />
77
    <orderEntry type="library" name="Maven: org.hibernate:hibernate-validator:4.3.0.Final" level="project" />
78
    <orderEntry type="library" name="Maven: javax.validation:validation-api:1.0.0.GA" level="project" />
79
    <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.1.0.CR2" level="project" />
80
    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-jpa:1.1.0.RELEASE" level="project" />
81
    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons-core:1.3.0.RELEASE" level="project" />
82
    <orderEntry type="library" name="Maven: junit:junit-dep:4.8.2" level="project" />
83
    <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.1" level="project" />
84
    <orderEntry type="library" name="Maven: org.springframework:spring-orm:3.2.7.RELEASE" level="project" />
85
    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:3.2.7.RELEASE" level="project" />
86
    <orderEntry type="library" name="Maven: org.springframework:spring-tx:3.2.7.RELEASE" level="project" />
87
    <orderEntry type="library" name="Maven: org.slf4j:jcl-over-slf4j:1.7.2" level="project" />
88
    <orderEntry type="library" name="Maven: org.aspectj:aspectjrt:1.6.12" level="project" />
89
    <orderEntry type="library" name="Maven: org.hsqldb:hsqldb:2.2.8" level="project" />
90
    <orderEntry type="library" name="Maven: joda-time:joda-time:2.1" level="project" />
91
    <orderEntry type="library" name="Maven: com.googlecode.flyway:flyway-core:2.1.1" level="project" />
92
    <orderEntry type="library" name="Maven: com.sun.jersey:jersey-servlet:1.12" level="project" />
93
    <orderEntry type="library" name="Maven: com.sun.jersey:jersey-server:1.12" level="project" />
94
    <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-jdbc:7.0.29" level="project" />
95
    <orderEntry type="library" name="Maven: org.apache.tomcat:tomcat-juli:7.0.29" level="project" />
96
    <orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:3.1.0" level="project" />
97
    <orderEntry type="library" name="Maven: javax.servlet.jsp.jstl:jstl-api:1.2" level="project" />
98
    <orderEntry type="library" name="Maven: javax.servlet:servlet-api:2.5" level="project" />
99
    <orderEntry type="library" name="Maven: javax.servlet.jsp:jsp-api:2.1" level="project" />
100
    <orderEntry type="library" name="Maven: javax.servlet:jsp-api:2.0" level="project" />
101
    <orderEntry type="library" name="Maven: mysql:mysql-connector-java:5.1.20" level="project" />
102
    <orderEntry type="library" name="Maven: postgresql:postgresql:9.1-901.jdbc4" level="project" />
103
    <orderEntry type="library" name="Maven: com.sun.jersey.contribs:jersey-spring:1.12" level="project" />
104
    <orderEntry type="library" name="Maven: org.surfnet.coin:spring-security-opensaml:4.0.0" level="project" />
105
    <orderEntry type="library" name="Maven: org.opensaml:opensaml:2.6.1" level="project" />
106
    <orderEntry type="library" name="Maven: org.opensaml:openws:1.5.1" level="project" />
107
    <orderEntry type="library" name="Maven: org.opensaml:xmltooling:1.4.1" level="project" />
108
    <orderEntry type="library" name="Maven: org.bouncycastle:bcprov-jdk15:1.46" level="project" />
109
    <orderEntry type="library" name="Maven: ca.juliusdavies:not-yet-commons-ssl:0.3.9" level="project" />
110
    <orderEntry type="library" name="Maven: commons-httpclient:commons-httpclient:3.1" level="project" />
111
    <orderEntry type="library" name="Maven: org.apache.santuario:xmlsec:1.5.6" level="project" />
112
    <orderEntry type="library" scope="RUNTIME" name="Maven: xerces:xercesImpl:2.10.0" level="project" />
113
    <orderEntry type="library" scope="RUNTIME" name="Maven: xalan:serializer:2.7.1" level="project" />
114
    <orderEntry type="library" scope="RUNTIME" name="Maven: xml-resolver:xml-resolver:1.2" level="project" />
115
    <orderEntry type="library" scope="RUNTIME" name="Maven: xalan:xalan:2.7.1" level="project" />
116
    <orderEntry type="library" name="Maven: org.apache.velocity:velocity:1.7" level="project" />
117
    <orderEntry type="library" name="Maven: org.owasp.esapi:esapi:2.0.1" level="project" />
118
    <orderEntry type="library" name="Maven: org.springframework:spring-web:3.2.7.RELEASE" level="project" />
119
    <orderEntry type="library" name="Maven: org.springframework:spring-context-support:3.1.3.RELEASE" level="project" />
120
    <orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:3.1.3.RELEASE" level="project" />
121
    <orderEntry type="library" name="Maven: org.springframework.security:spring-security-web:3.1.3.RELEASE" level="project" />
122
    <orderEntry type="library" name="Maven: commons-io:commons-io:2.0.1" level="project" />
123
    <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:3.2.7.RELEASE" level="project" />
124
    <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:3.2.7.RELEASE" level="project" />
125
    <orderEntry type="library" name="Maven: xml-apis:xml-apis:1.4.01" level="project" />
126
    <orderEntry type="library" name="Maven: com.yammer.dropwizard:dropwizard-auth:0.4.2" level="project" />
127
    <orderEntry type="library" name="Maven: com.yammer.dropwizard:dropwizard-core:0.4.2" level="project" />
128
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-core:2.1.2" level="project" />
129
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-servlet:2.1.2" level="project" />
130
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-jetty:2.1.2" level="project" />
131
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:8.1.4.v20120524" level="project" />
132
    <orderEntry type="library" name="Maven: org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016" level="project" />
133
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-continuation:8.1.4.v20120524" level="project" />
134
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-http:8.1.4.v20120524" level="project" />
135
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:8.1.4.v20120524" level="project" />
136
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:8.1.9.v20130131" level="project" />
137
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-logback:2.1.2" level="project" />
138
    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.0.6" level="project" />
139
    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.0.6" level="project" />
140
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-jersey:2.1.2" level="project" />
141
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-annotation:2.1.2" level="project" />
142
    <orderEntry type="library" name="Maven: com.fasterxml.jackson:jackson-datatype-guava:1.9.1" level="project" />
143
    <orderEntry type="library" name="Maven: com.google.guava:guava:12.0" level="project" />
144
    <orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:1.3.9" level="project" />
145
    <orderEntry type="library" name="Maven: commons-cli:commons-cli:1.2" level="project" />
146
    <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.2" level="project" />
147
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-servlet:8.1.4.v20120524" level="project" />
148
    <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-security:8.1.4.v20120524" level="project" />
149
    <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.10" level="project" />
150
    <orderEntry type="library" name="Maven: com.yammer.dropwizard:dropwizard-views:0.4.2" level="project" />
151
    <orderEntry type="library" name="Maven: com.sun.jersey.contribs:jersey-freemarker:1.12" level="project" />
152
    <orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.19" level="project" />
153
    <orderEntry type="library" name="Maven: org.mockito:mockito-all:1.9.0" level="project" />
154
    <orderEntry type="library" name="Maven: com.yammer.dropwizard:dropwizard-client:0.4.2" level="project" />
155
    <orderEntry type="library" name="Maven: com.sun.jersey.contribs:jersey-apache-client4:1.12" level="project" />
156
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.2" level="project" />
157
    <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.2" level="project" />
158
    <orderEntry type="library" name="Maven: com.yammer.metrics:metrics-httpclient:2.1.2" level="project" />
159
    <orderEntry type="library" scope="TEST" name="Maven: org.seleniumhq.selenium:selenium-firefox-driver:2.32.0" level="project" />
160
    <orderEntry type="library" scope="TEST" name="Maven: org.seleniumhq.selenium:selenium-remote-driver:2.32.0" level="project" />
161
    <orderEntry type="library" scope="TEST" name="Maven: cglib:cglib-nodep:2.1_3" level="project" />
162
    <orderEntry type="library" scope="TEST" name="Maven: org.json:json:20080701" level="project" />
163
    <orderEntry type="library" scope="TEST" name="Maven: org.seleniumhq.selenium:selenium-api:2.32.0" level="project" />
164
    <orderEntry type="library" scope="TEST" name="Maven: org.apache.commons:commons-exec:1.1" level="project" />
165
    <orderEntry type="library" scope="TEST" name="Maven: net.java.dev.jna:jna:3.4.0" level="project" />
166
    <orderEntry type="library" scope="TEST" name="Maven: net.java.dev.jna:platform:3.4.0" level="project" />
167
    <orderEntry type="library" scope="TEST" name="Maven: org.seleniumhq.selenium:selenium-support:2.32.0" level="project" />
168
    <orderEntry type="library" scope="TEST" name="Maven: org.seleniumhq.selenium:selenium-htmlunit-driver:2.32.0" level="project" />
169
    <orderEntry type="library" scope="TEST" name="Maven: net.sourceforge.htmlunit:htmlunit:2.12" level="project" />
170
    <orderEntry type="library" scope="TEST" name="Maven: org.apache.commons:commons-lang3:3.1" level="project" />
171
    <orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpmime:4.2.3" level="project" />
172
    <orderEntry type="library" scope="TEST" name="Maven: net.sourceforge.htmlunit:htmlunit-core-js:2.12" level="project" />
173
    <orderEntry type="library" scope="TEST" name="Maven: net.sourceforge.nekohtml:nekohtml:1.9.18" level="project" />
174
    <orderEntry type="library" scope="TEST" name="Maven: net.sourceforge.cssparser:cssparser:0.9.9" level="project" />
175
    <orderEntry type="library" scope="TEST" name="Maven: org.w3c.css:sac:1.3" level="project" />
176
    <orderEntry type="library" scope="TEST" name="Maven: org.eclipse.jetty:jetty-websocket:8.1.9.v20130131" level="project" />
177
    <orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpclient:tests:4.2" level="project" />
178
    <orderEntry type="library" name="Maven: log4j:log4j:1.2.17" level="project" />
179
  </component>
180
</module>
181

  
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/repositories/ClientRepo.java
1
package eu.dnetlib.oauth.repositories;
2

  
3
import org.surfnet.oaaas.repository.ClientRepository;
4

  
5
import javax.inject.Inject;
6
import javax.sql.DataSource;
7

  
8
/**
9
 * Created by envy17 j110ea on 18/1/2015.
10
 */
11
public abstract class ClientRepo implements ClientRepository {
12
    private DataSource dataSource;
13

  
14
    /*
15
       @Override
16
       public Client findByClientId(String clientId) {
17
           java.sql.Connection con= null;
18
           try {
19
               con = dataSource.getConnection();
20
          PreparedStatement stmt=  con.prepareStatement("Select * from client where id=?");
21
               stmt.setString(1,clientId);
22
           ResultSet res=stmt.executeQuery();
23
               Client client= new Client();
24

  
25
               }
26
           } catch (SQLException e) {
27
               e.printStackTrace();
28
           }
29

  
30
       }
31
   */
32
    public DataSource getDataSource() {
33
        return dataSource;
34
    }
35

  
36
    @Inject
37
    public void setDataSource(DataSource dataSource) {
38
        this.dataSource = dataSource;
39
    }
40

  
41
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/store/LDAPStore.java
1
package eu.dnetlib.oauth.store;
2

  
3
import com.unboundid.ldap.sdk.*;
4
import com.unboundid.ldap.sdk.schema.ObjectClassDefinition;
5
import com.unboundid.ldap.sdk.schema.Schema;
6
import com.unboundid.util.ssl.SSLUtil;
7
import com.unboundid.util.ssl.TrustAllTrustManager;
8
import org.slf4j.Logger;
9
import org.slf4j.LoggerFactory;
10
import org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal;
11

  
12
import java.util.*;
13
import java.util.Map.Entry;
14

  
15
public class LDAPStore implements CredentialsStore {
16
    private String username;
17
    private String password;
18
    private String ldapURL;
19
    private int port;
20
    private String SSL;
21
    private final Logger log = LoggerFactory.getLogger(this.getClass());
22
    private BindResult admin_bind = null;
23
    private int initialConnections = 2;
24
    private int maxConnections = 20;
25

  
26
    @Override
27
    public AuthenticatedPrincipal authenticate(String username, String password) throws Exception {
28
        //
29
        HashMap<String, String> Search_Fields = new HashMap<String, String>();
30
        //
31
        Search_Fields.put("cn", username);
32
        Search_Fields.put("userPassword", password);
33
        //
34
        // ->insert full attrs here, create User class
35

  
36
        ArrayList<String> Attrs = new ArrayList<String>();
37
        Attrs.add("cn");
38
        Attrs.add("userPassword");
39
        Attrs.add("JoomlaGroup");
40
        Attrs.add("DisplayName");
41

  
42
        log.info(" Lookin up User" + username);
43

  
44
        SearchResult search_user = this.search_user(Attrs, Search_Fields);
45

  
46
        if (search_user.getSearchEntries().isEmpty()) {
47
            log.error("User" + username + " Does not Exist in LDAP Credentials Store ");
48
            return null;
49
        }
50

  
51
        ArrayList<String> roles = new ArrayList<String>();
52
        roles.add(search_user.getSearchEntries().get(0).getAttributeValue(("JoomlaGroup")));
53

  
54
        AuthenticatedPrincipal authenticatedPrincipal = new AuthenticatedPrincipal();
55
        authenticatedPrincipal.setName(username);
56
        authenticatedPrincipal.setRoles(roles);
57
        authenticatedPrincipal.setAttributes((Map<String, String>) search_user.getSearchEntries().get(0).getAttributes());
58

  
59
        return authenticatedPrincipal;
60

  
61
    }
62

  
63
    public LDAPStore() {
64
        log.info(" Initiated LDAP Store");
65
    }
66

  
67
    private LDAPConnection connect() throws Exception {
68
        LDAPConnection connection;
69
        if (SSL.equalsIgnoreCase("true")) {
70
            SSLUtil sslUtil = new SSLUtil(new TrustAllTrustManager());
71
            connection = new LDAPConnection(sslUtil.createSSLSocketFactory());
72
        }
73

  
74
        if (port <= 0) {
75
            final StringBuilder builder = new StringBuilder(port);
76
            builder.append(" Illegal value for port.");
77
            throw new IllegalArgumentException(builder.toString());
78
        }
79

  
80
        connection = new LDAPConnection(ldapURL, port, username, password);
81

  
82
        log.info("Established Connection");
83

  
84
        this.admin_bind = connection.bind(new SimpleBindRequest(username, password));
85
        return connection;
86

  
87
    }
88

  
89
    private void close(LDAPConnection connection) {
90

  
91
        log.info("Connection Closed");
92

  
93
        connection.close();
94
        this.admin_bind = null;
95

  
96
    }
97

  
98
    /*
99
     * Searches for user in ldap Takes Attributes and values as args ie: name=
100
     * "test" userPassword="testpass" etc
101
     */
102
    private SearchResult search_user(List<String> attributes, HashMap<String, String> Search_Fields) throws Exception {
103
        LDAPConnection connection = null;
104
        try {
105
            connection = this.connect();
106
            log.info("Sucessfully established connection to : " + this.ldapURL + " at " + this.port);
107
        } catch (Exception e) {
108
            log.error("Fail to establish connection to : " + this.ldapURL + " at " + this.port + ". Reason: " + e.toString());
109

  
110
        }
111

  
112
        if (this.admin_bind.getResultCode().isConnectionUsable()) {
113
            get_ldap_schema();
114
            ArrayList<Filter> List_of_Filters = new ArrayList<Filter>();
115

  
116
            for (Entry<String, String> field : Search_Fields.entrySet()) {
117

  
118
                {
119
                    List_of_Filters.add(Filter.createEqualityFilter(field.getKey(), field.getValue()));
120
                }
121

  
122
            }
123
            Filter filters = Filter.createANDFilter(List_of_Filters);
124

  
125
            log.info("Search Filter: " + filters.toString());
126

  
127
            // TO DO: remove dc=... from here, pass it as parameter
128
            SearchRequest request = new SearchRequest("dc=openaire,dc=eu", SearchScope.SUB, filters, attributes.toArray(new String[attributes.size()]));
129

  
130
            SearchResult search = connection.search(request);
131

  
132
            for (SearchResultEntry i : search.getSearchEntries()) {
133
                log.info(i + "\n");
134
            }
135

  
136
            close(connection);
137
            return search;
138

  
139
        } else {
140
            log.error("LDAP Server is not Listening ");
141
            throw new Exception("LDAP Server is not Listening ");
142
        }
143
    }
144

  
145
    /*
146
     * For testing only- GET LDAP SCHEMA AND ATTRIBUTES SYNTAX
147
     */
148
    private void get_ldap_schema() throws Exception {
149
        LDAPConnection connection = connect();
150
        Schema schema = connection.getSchema();
151
        Set<ObjectClassDefinition> abstractObjectClasses = schema.getAbstractObjectClasses();
152
        //
153
        log.info(abstractObjectClasses.toString());
154
        //
155
        log.info(schema.getAttributeSyntaxes().toString());
156
        //
157
        log.info(schema.getAttributeTypes().toString());
158

  
159
        close(connection);
160
    }
161

  
162
    public String getUsername() {
163
        return username;
164
    }
165

  
166
    public void setUsername(String username) {
167
        this.username = username;
168
    }
169

  
170
    public String getPassword() {
171
        return password;
172
    }
173

  
174
    public void setPassword(String password) {
175
        this.password = password;
176
    }
177

  
178
    public String getLdapURL() {
179
        return ldapURL;
180
    }
181

  
182
    public void setLdapURL(String ldapURL) {
183
        this.ldapURL = ldapURL;
184
    }
185

  
186
    public int getPort() {
187
        return port;
188
    }
189

  
190
    public void setPort(int port) {
191
        this.port = port;
192
    }
193

  
194
    public String getSSL() {
195
        return SSL;
196
    }
197

  
198
    public void setSSL(String sSL) {
199
        SSL = sSL;
200
    }
201

  
202
    public BindResult getAdmin_bind() {
203
        return admin_bind;
204
    }
205

  
206
    public void setAdmin_bind(BindResult admin_bind) {
207
        this.admin_bind = admin_bind;
208
    }
209

  
210
    public int getInitialConnections() {
211
        return initialConnections;
212
    }
213

  
214
    public void setInitialConnections(int initialConnections) {
215
        this.initialConnections = initialConnections;
216
    }
217

  
218
    public int getMaxConnections() {
219
        return maxConnections;
220
    }
221

  
222
    public void setMaxConnections(int maxConnections) {
223
        this.maxConnections = maxConnections;
224
    }
225

  
226
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/store/DBStore.java
1
package eu.dnetlib.oauth.store;
2

  
3
import org.slf4j.Logger;
4
import org.slf4j.LoggerFactory;
5
import org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal;
6

  
7
import javax.inject.Inject;
8
import javax.sql.DataSource;
9
import java.sql.Connection;
10
import java.sql.PreparedStatement;
11
import java.sql.ResultSet;
12
import java.sql.SQLException;
13
import java.util.ArrayList;
14

  
15
public class DBStore implements CredentialsStore {
16

  
17
    private DataSource authenticationRepository;
18
    private final Logger log = LoggerFactory.getLogger(this.getClass());
19
    private Connection connection = null;
20

  
21
    public DBStore() {
22
    }
23

  
24
    ;
25

  
26
    @Override
27
    public AuthenticatedPrincipal authenticate(String username, String password) throws Exception {
28

  
29
        try {
30
            AuthenticatedPrincipal principal = null;
31
            connection = authenticationRepository.getConnection();
32
            PreparedStatement pstmt = connection.prepareStatement("select * from \"user\",\"user_has_roles\" where username = ? " + "" + " and password= ? " + "" + " and \"user_has_roles\".user_id = \"user\".user_id ;");
33
            pstmt.setString(1, username);
34
            pstmt.setString(2, password);
35

  
36
            ResultSet rs = pstmt.executeQuery();
37

  
38
            ArrayList<String> roles = new ArrayList<String>();
39

  
40
            if (rs == null) {
41
                log.error("User does not exist in SQL DBStore");
42
                pstmt.close();
43
                throw new Exception("User " + username + "does not exist in SQL DBStore");
44
            }
45

  
46
            while (rs.next()) {
47

  
48
                String role = (String) rs.getObject("role");
49
                log.info("Role for user " + username + " : " + role);
50
                roles.add(role);
51

  
52
            }
53

  
54
            principal = new AuthenticatedPrincipal(username, roles);
55

  
56
            log.info("Created Principal " + principal.toString());
57
            pstmt.close();
58

  
59
            return principal;
60
        } catch (SQLException e) {
61

  
62
            log.error("Cannnot initate connection to datasource : " + e.toString());
63
            throw new Exception("Cannnot initate connection to datasource : " + e);
64
        } finally {
65

  
66
            if (connection != null) {
67
                connection.close();
68
            }
69
        }
70

  
71
    }
72

  
73
    public DataSource getAuthenticationRepository() {
74
        return authenticationRepository;
75
    }
76

  
77
    @Inject
78
    public void setAuthenticationRepository(DataSource authenticationRepository) {
79
        this.authenticationRepository = authenticationRepository;
80
    }
81

  
82
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/store/CredentialsStore.java
1
package eu.dnetlib.oauth.store;
2

  
3

  
4
import org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal;
5

  
6
/**
7
 * @author eri Generic Credentials store that authenticates a user against a DB,
8
 *         LDAP instance, or whatever implementation is used
9
 */
10

  
11
public interface CredentialsStore {
12

  
13
    public AuthenticatedPrincipal authenticate(String username, String password) throws Exception;
14

  
15
    // TODO here main methods for validating user againts the credential stores
16

  
17

  
18
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/authenticate/Authenticator.java
1
package eu.dnetlib.oauth.authenticate;
2

  
3
import eu.dnetlib.oauth.store.CredentialsStore;
4
import org.slf4j.Logger;
5
import org.slf4j.LoggerFactory;
6
import org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal;
7

  
8
/**
9
 * Created by envy17 j110ea on 13/2/2015.
10
 */
11
public class Authenticator {
12

  
13
    private CredentialsStore LDAPStore;
14
    private CredentialsStore DBStore;
15

  
16
    private final Logger log = LoggerFactory.getLogger(this.getClass());
17

  
18
    public AuthenticatedPrincipal doAuthenticate(String username, String password) throws Exception {
19
        log.info("Authenticating against multiple stores..");
20
        AuthenticatedPrincipal principal = null;
21
        principal = DBStore.authenticate(username, password);
22

  
23
        if (principal == null) {
24
            log.error("User not found in database ");
25
            principal = LDAPStore.authenticate(username, password);
26
        }
27

  
28
        if (principal == null) {
29
            log.error("User not found ");
30
            throw new Exception("User not found ");
31

  
32
        }
33
        return principal;
34
    }
35

  
36
    public CredentialsStore getLDAPStore() {
37
        return LDAPStore;
38
    }
39

  
40
    public void setLDAPStore(CredentialsStore LDAPStore) {
41
        this.LDAPStore = LDAPStore;
42
    }
43

  
44
    public CredentialsStore getDBStore() {
45
        return DBStore;
46
    }
47

  
48
    public void setDBStore(CredentialsStore DBStore) {
49
        this.DBStore = DBStore;
50
    }
51
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/handlers/FormLoginAuthenticator.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
package eu.dnetlib.oauth.handlers;
20

  
21
import eu.dnetlib.oauth.authenticate.Authenticator;
22
import org.slf4j.Logger;
23
import org.slf4j.LoggerFactory;
24
import org.springframework.beans.factory.annotation.Autowired;
25
import org.surfnet.oaaas.auth.AbstractAuthenticator;
26
import org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal;
27

  
28
import javax.inject.Inject;
29
import javax.inject.Named;
30
import javax.servlet.FilterChain;
31
import javax.servlet.ServletException;
32
import javax.servlet.ServletResponse;
33
import javax.servlet.http.HttpServletRequest;
34
import javax.servlet.http.HttpServletResponse;
35
import javax.servlet.http.HttpSession;
36
import java.io.IOException;
37

  
38
/**
39
 * {@link AbstractAuthenticator} that redirects to a form. Note that other
40
 * implementations can go wild because they have access to the
41
 * {@link HttpServletRequest} and {@link HttpServletResponse}.
42
 */
43
@Named("formAuthenticator")
44

  
45
public class FormLoginAuthenticator extends AbstractAuthenticator {
46

  
47
    private static final String SESSION_IDENTIFIER = "AUTHENTICATED_PRINCIPAL";
48
    @Autowired
49
    private Authenticator multiAuthenticator;
50
    private final Logger log = LoggerFactory.getLogger(this.getClass());
51

  
52
    @Override
53
    public boolean canCommence(HttpServletRequest request) {
54

  
55
        log.info("Form login Authenticator: Checking can commence...");
56
        return request.getMethod().equals("POST") && request.getParameter(AUTH_STATE) != null
57
                && request.getParameter("j_username") != null;
58
    }
59

  
60
    @Override
61
    public void authenticate(HttpServletRequest request, HttpServletResponse response, FilterChain chain,
62
                             String authStateValue, String returnUri) throws IOException, ServletException {
63
        HttpSession session = request.getSession(false);
64
        log.info("Attempting authentication");
65

  
66
        AuthenticatedPrincipal principal = (AuthenticatedPrincipal) (session != null ? session
67
                .getAttribute(SESSION_IDENTIFIER) : null);
68

  
69

  
70
        if (true)
71
        //(request.getMethod().equals("POST"))
72

  
73
        {
74
            log.info("HTTP REQUEST IS POST");
75
            processForm(request);
76
            chain.doFilter(request, response);
77
        } else if (principal != null) {
78
            log.info("HTTPS IS NOT POST AND PRINCIPAL IS NOT NULL");
79
            // we stil have the session
80
            setAuthStateValue(request, authStateValue);
81
            setPrincipal(request, principal);
82
            chain.doFilter(request, response);
83
        } else {
84
            log.info("HTTP REQUEST  IS NOT POST , principal is  NULL AND processing Initial FORM "
85
            );
86
            processInitial(request, response, returnUri, authStateValue);
87
        }
88
    }
89

  
90
    private void processInitial(HttpServletRequest request, ServletResponse response, String returnUri,
91
                                String authStateValue) throws IOException, ServletException {
92

  
93
        request.setAttribute(AUTH_STATE, authStateValue);
94
        request.setAttribute("actionUri", returnUri);
95
        log.info("SET AUTH STATE " + authStateValue + " AND ACTION  URI" + returnUri);
96
        //TODO Eri why is this hardcoded? How can we make this dynamic????
97
        request.getRequestDispatcher("/WEB-INF/jsp/login.jsp").forward(request, response);
98
    }
99

  
100

  
101
    /**
102
     * Hook for actually validating the username/ password against a database,
103
     * ldap, external webservice or whatever to perform authentication
104
     *
105
     * @param request the {@link HttpServletRequest}
106
     */
107
    protected void processForm(final HttpServletRequest request) {
108
        setAuthStateValue(request, request.getParameter(AUTH_STATE));
109
        //new AuthenticatedPrincipal(request.getParameter("j_username"));
110
        //TODO here authentication occurs
111

  
112
        try {
113

  
114
            log.debug("Attempting login with : " + request.getParameter("j_username") + request.getParameter("j_password"));
115

  
116
            AuthenticatedPrincipal principal = multiAuthenticator.doAuthenticate(request.getParameter("j_username"), request.getParameter("j_password"));
117

  
118
            request.getSession().setAttribute(SESSION_IDENTIFIER, principal);
119
            setPrincipal(request, principal);
120

  
121
        } catch (Exception ex) {
122
            log.error("Authentication Failed. Reason: " + ex.toString());
123

  
124
        }
125
    }
126

  
127
    public Authenticator getMultiAuthenticator() {
128
        return multiAuthenticator;
129
    }
130

  
131
    @Inject
132
    public void setMultiAuthenticator(Authenticator multiAuthenticator) {
133
        this.multiAuthenticator = multiAuthenticator;
134
    }
135
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/handlers/FormUserConsentHandler.java
1
/*
2
 * Licensed to the Apache Software Foundation (ASF) under one
3
 * or more contributor license agreements.  See the NOTICE file
4
 * distributed with this work for additional information
5
 * regarding copyright ownership.  The ASF licenses this file
6
 * to you under the Apache License, Version 2.0 (the
7
 * "License"); you may not use this file except in compliance
8
 * with the License.  You may obtain a copy of the License at
9
 *
10
 *   http://www.apache.org/licenses/LICENSE-2.0
11
 *
12
 * Unless required by applicable law or agreed to in writing,
13
 * software distributed under the License is distributed on an
14
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
 * KIND, either express or implied.  See the License for the
16
 * specific language governing permissions and limitations
17
 * under the License.
18
 */
19
package eu.dnetlib.oauth.handlers;
20

  
21
import org.apache.commons.collections.CollectionUtils;
22
import org.apache.commons.lang.StringUtils;
23
import org.springframework.http.HttpMethod;
24
import org.surfnet.oaaas.auth.AbstractAuthenticator;
25
import org.surfnet.oaaas.auth.AbstractUserConsentHandler;
26
import org.surfnet.oaaas.auth.principal.AuthenticatedPrincipal;
27
import org.surfnet.oaaas.model.AccessToken;
28
import org.surfnet.oaaas.model.AuthorizationRequest;
29
import org.surfnet.oaaas.model.Client;
30
import org.surfnet.oaaas.repository.AccessTokenRepository;
31
import org.surfnet.oaaas.repository.AuthorizationRequestRepository;
32

  
33
import javax.inject.Inject;
34
import javax.inject.Named;
35
import javax.servlet.FilterChain;
36
import javax.servlet.ServletException;
37
import javax.servlet.ServletResponse;
38
import javax.servlet.http.HttpServletRequest;
39
import javax.servlet.http.HttpServletResponse;
40
import java.io.IOException;
41
import java.util.List;
42

  
43
/**
44
 * Example {@link AbstractUserConsentHandler} that forwards to a form.
45
 */
46
@Named("formConsentHandler")
47
public class FormUserConsentHandler extends AbstractUserConsentHandler {
48

  
49
    private static final String USER_OAUTH_APPROVAL = "user_oauth_approval";
50

  
51
    @Inject
52
    private AccessTokenRepository accessTokenRepository;
53

  
54
    @Inject
55
    private AuthorizationRequestRepository authorizationRequestRepository;
56

  
57
    @Override
58
    public void handleUserConsent(HttpServletRequest request, HttpServletResponse response, FilterChain chain,
59
                                  String authStateValue, String returnUri, Client client) throws IOException, ServletException {
60
        if (isUserConsentPost(request)) {
61
            if (processForm(request, response)) {
62
                chain.doFilter(request, response);
63
            }
64
        } else {
65
            processInitial(request, response, chain, returnUri, authStateValue, client);
66
        }
67
    }
68

  
69
    private boolean isUserConsentPost(HttpServletRequest request) {
70
        String oauthApproval = request.getParameter(USER_OAUTH_APPROVAL);
71
        return request.getMethod().equals(HttpMethod.POST.toString()) && StringUtils.isNotBlank(oauthApproval);
72
    }
73

  
74
    private void processInitial(HttpServletRequest request, ServletResponse response, FilterChain chain,
75
                                String returnUri, String authStateValue, Client client) throws IOException, ServletException {
76
        AuthenticatedPrincipal principal = (AuthenticatedPrincipal) request.getAttribute(AbstractAuthenticator.PRINCIPAL);
77
        List<AccessToken> tokens = accessTokenRepository.findByResourceOwnerIdAndClient(principal.getName(), client);
78
        if (!CollectionUtils.isEmpty(tokens)) {
79
            // If another token is already present for this resource owner and client, no new consent should be requested
80
            List<String> grantedScopes = tokens.get(0).getScopes(); // take the scopes of the first access token found.
81
            setGrantedScopes(request, grantedScopes.toArray(new String[grantedScopes.size()]));
82
            chain.doFilter(request, response);
83
        } else {
84
            AuthorizationRequest authorizationRequest = authorizationRequestRepository.findByAuthState(authStateValue);
85
            request.setAttribute("requestedScopes", authorizationRequest.getRequestedScopes());
86
            request.setAttribute("client", client);
87
            request.setAttribute(AUTH_STATE, authStateValue);
88
            request.setAttribute("actionUri", returnUri);
89
            ((HttpServletResponse) response).setHeader("X-Frame-Options", "SAMEORIGIN");
90
            request.getRequestDispatcher(getUserConsentUrl()).forward(request, response);
91
        }
92

  
93
    }
94

  
95
    /**
96
     * Return the path to the User Consent page. Subclasses can use this hook by
97
     * providing a custom html/jsp.
98
     *
99
     * @return the path to the User Consent page
100
     */
101
    protected String getUserConsentUrl() {
102
        return "/WEB-INF/jsp/userconsent.jsp";
103
    }
104

  
105
    private boolean processForm(final HttpServletRequest request, final HttpServletResponse response)
106
            throws ServletException, IOException {
107
        if (Boolean.valueOf(request.getParameter(USER_OAUTH_APPROVAL))) {
108
            setAuthStateValue(request, request.getParameter(AUTH_STATE));
109
            String[] scopes = request.getParameterValues(GRANTED_SCOPES);
110
            setGrantedScopes(request, scopes);
111
            return true;
112
        } else {
113
            request.getRequestDispatcher(getUserConsentDeniedUrl()).forward(request, response);
114
            return false;
115
        }
116
    }
117

  
118
    /**
119
     * @return
120
     */
121
    protected String getUserConsentDeniedUrl() {
122
        return "/WEB-INF/jsp/userconsent_denied.jsp";
123
    }
124

  
125
}
modules/uoa-oauth-server/src/main/java/eu/dnetlib/oauth/config/SpringConfiguration.java
1
/*
2
 * Copyright 2012 SURFnet bv, The Netherlands
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

  
17
package eu.dnetlib.oauth.config;
18

  
19
import eu.dnetlib.oauth.authenticate.Authenticator;
20
import eu.dnetlib.oauth.handlers.FormLoginAuthenticator;
21
import eu.dnetlib.oauth.store.CredentialsStore;
22
import eu.dnetlib.oauth.store.DBStore;
23
import eu.dnetlib.oauth.store.LDAPStore;
24
import org.apache.openjpa.persistence.PersistenceProviderImpl;
25
import org.apache.tomcat.jdbc.pool.DataSource;
26
import org.springframework.context.annotation.*;
27
import org.springframework.core.env.Environment;
28
import org.springframework.orm.jpa.JpaTransactionManager;
29
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
30
import org.springframework.scheduling.annotation.EnableScheduling;
31
import org.springframework.transaction.annotation.EnableTransactionManagement;
32
import org.surfnet.oaaas.auth.*;
33
import org.surfnet.oaaas.repository.ExceptionTranslator;
34
import org.surfnet.oaaas.repository.OpenJPAExceptionTranslator;
35
import org.surfnet.oaaas.support.Cleaner;
36

  
37
import javax.inject.Inject;
38
import javax.servlet.Filter;
39
import javax.servlet.ServletException;
40
import javax.validation.Validator;
41

  
42
/**
43
 * The SpringConfiguration is a {@link Configuration} that can be overridden if
44
 * you want to plugin your own implementations. Note that the two most likely
45
 * candidates to change are the {@link AbstractAuthenticator} an
46
 * {@link AbstractUserConsentHandler}. You can change the implementation by
47
 * editing the application.apis.properties file where the implementations are
48
 * configured.
49
 */
50
@Configuration
51
@PropertySource("classpath:apis.application.properties")
52
/*
53
 * The component scan can be used to add packages and exclusions to the default
54
 * package
55
 */
56
@ComponentScan(basePackages = {"eu.dnetlib.oauth.resource"})
57
@ImportResource("classpath:spring-repositories.xml")
58
@EnableTransactionManagement
59
@EnableScheduling
60
public class SpringConfiguration {
61

  
62
    private static final String PERSISTENCE_UNIT_NAME = "oaaas";
63
    private static final Class<PersistenceProviderImpl> PERSISTENCE_PROVIDER_CLASS = PersistenceProviderImpl.class;
64

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff