Merge pull request #4 from indigo-iam/merge-remote
Merge updates from source repo into our development branchpull/1611/head
commit
d58c826937
|
@ -1,7 +1,11 @@
|
||||||
language: java
|
language: java
|
||||||
jdk:
|
jdk:
|
||||||
- oraclejdk8
|
- oraclejdk11
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- bash <(curl -s https://codecov.io/bash)
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- $HOME/.m2
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
Unreleased:
|
Unreleased:
|
||||||
|
|
||||||
|
*1.3.3*:
|
||||||
- Authorization codes are now longer
|
- Authorization codes are now longer
|
||||||
- Client/RS can parse the "sub" and "user_id" claims in introspection response
|
- Client/RS can parse the "sub" and "user_id" claims in introspection response
|
||||||
- Database-direct queries for fetching tokens by user (optimization)
|
- Database-direct queries for fetching tokens by user (optimization)
|
||||||
|
@ -6,9 +8,12 @@ Unreleased:
|
||||||
- Long scopes display properly and are still checkable
|
- Long scopes display properly and are still checkable
|
||||||
- Language system remebers when it can't find a file and stops throwing so many errors
|
- Language system remebers when it can't find a file and stops throwing so many errors
|
||||||
- Index added for refresh tokens
|
- Index added for refresh tokens
|
||||||
- Updated to Spring Security 4.2.4
|
- Updated to Spring Security 4.2.11
|
||||||
|
- Updated Spring to 4.3.22
|
||||||
|
- Change approve pages to use issuer instead of page context
|
||||||
|
- Updated oracle database scripts
|
||||||
|
|
||||||
*1.3.2:
|
*1.3.2*:
|
||||||
- Added changelog
|
- Added changelog
|
||||||
- Set default redirect URI resolver strict matching to true
|
- Set default redirect URI resolver strict matching to true
|
||||||
- Fixed XSS vulnerability on redirect URI display on approval page
|
- Fixed XSS vulnerability on redirect URI display on approval page
|
||||||
|
|
|
@ -28,4 +28,4 @@ The authors and key contributors of the project include:
|
||||||
* [Mark Janssen](https://github.com/praseodym)
|
* [Mark Janssen](https://github.com/praseodym)
|
||||||
|
|
||||||
|
|
||||||
Copyright ©2018, [MIT Internet Trust Consortium](http://www.trust.mit.edu/). Licensed under the Apache 2.0 license, for details see `LICENSE.txt`.
|
Licensed under the Apache 2.0 license, for details see `LICENSE.txt`.
|
||||||
|
|
|
@ -87,6 +87,26 @@
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.xml.bind</groupId>
|
||||||
|
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mitre</groupId>
|
<groupId>org.mitre</groupId>
|
||||||
<artifactId>openid-connect-parent</artifactId>
|
<artifactId>openid-connect-parent</artifactId>
|
||||||
<version>1.3.3-SNAPSHOT</version>
|
<version>1.3.5-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>openid-connect-server-webapp</artifactId>
|
<artifactId>openid-connect-server-webapp</artifactId>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xmlns:util="http://www.springframework.org/schema/util"
|
xmlns:util="http://www.springframework.org/schema/util"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd
|
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<!-- Scan for components -->
|
<!-- Scan for components -->
|
||||||
<context:component-scan annotation-config="true" base-package="org.mitre" />
|
<context:component-scan annotation-config="true" base-package="org.mitre" />
|
||||||
|
@ -246,9 +246,15 @@
|
||||||
<property name="authenticationManager" ref="clientAssertionAuthenticationManager" />
|
<property name="authenticationManager" ref="clientAssertionAuthenticationManager" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="noOpPasswordEncoder" class="org.springframework.security.crypto.password.NoOpPasswordEncoder"/>
|
||||||
|
|
||||||
<security:authentication-manager id="clientAuthenticationManager">
|
<security:authentication-manager id="clientAuthenticationManager">
|
||||||
<security:authentication-provider user-service-ref="clientUserDetailsService" />
|
<security:authentication-provider user-service-ref="clientUserDetailsService">
|
||||||
<security:authentication-provider user-service-ref="uriEncodedClientUserDetailsService" />
|
<security:password-encoder ref="noOpPasswordEncoder"/>
|
||||||
|
</security:authentication-provider>
|
||||||
|
<security:authentication-provider user-service-ref="uriEncodedClientUserDetailsService">
|
||||||
|
<security:password-encoder ref="noOpPasswordEncoder"/>
|
||||||
|
</security:authentication-provider>
|
||||||
</security:authentication-manager>
|
</security:authentication-manager>
|
||||||
|
|
||||||
<security:authentication-manager id="clientAssertionAuthenticationManager">
|
<security:authentication-manager id="clientAssertionAuthenticationManager">
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<!-- validate incoming tokens for JWT assertions -->
|
<!-- validate incoming tokens for JWT assertions -->
|
||||||
<bean id="jwtAssertionValidator" class="org.mitre.jwt.assertion.impl.NullAssertionValidator" />
|
<bean id="jwtAssertionValidator" class="org.mitre.jwt.assertion.impl.NullAssertionValidator" />
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
|
|
||||||
<oauth:authorization-server
|
<oauth:authorization-server
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<bean id="defaultKeyStore" class="org.mitre.jose.keystore.JWKSetKeyStore">
|
<bean id="defaultKeyStore" class="org.mitre.jose.keystore.JWKSetKeyStore">
|
||||||
<property name="location" value="classpath:keystore.jwks" />
|
<property name="location" value="classpath:keystore.jwks" />
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd">
|
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd">
|
||||||
|
|
||||||
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
|
<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="close">
|
||||||
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
|
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
|
|
||||||
<!-- This file allows you to define additional endpoints, it's normally empty in the OIDC server and has entries in the UMA server -->
|
<!-- This file allows you to define additional endpoints, it's normally empty in the OIDC server and has entries in the UMA server -->
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
||||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
|
|
||||||
<!-- Empty: Override this file in your local project to change configuration options. -->
|
<!-- Empty: Override this file in your local project to change configuration options. -->
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<bean id="configBean" class="org.mitre.openid.connect.config.ConfigurationPropertiesBean">
|
<bean id="configBean" class="org.mitre.openid.connect.config.ConfigurationPropertiesBean">
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<!-- This file has been left blank -->
|
<!-- This file has been left blank -->
|
||||||
<!-- Feel free to override this by using a maven overlay. -->
|
<!-- Feel free to override this by using a maven overlay. -->
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<meta name="description" content="">
|
<meta name="description" content="">
|
||||||
<meta name="author" content="">
|
<meta name="author" content="">
|
||||||
|
<meta name="referrer" content="strict-origin-when-cross-origin"/>
|
||||||
|
|
||||||
<!-- stylesheets -->
|
<!-- stylesheets -->
|
||||||
<link href="resources/bootstrap2/css/bootstrap.css" rel="stylesheet">
|
<link href="resources/bootstrap2/css/bootstrap.css" rel="stylesheet">
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:task="http://www.springframework.org/schema/task"
|
xmlns:task="http://www.springframework.org/schema/task"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd">
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||||
|
|
||||||
<!-- Configuration for scheduled tasks -->
|
<!-- Configuration for scheduled tasks -->
|
||||||
<task:scheduler id="taskScheduler" pool-size="10" />
|
<task:scheduler id="taskScheduler" pool-size="10" />
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
|
|
||||||
<!-- This file allows you to define components to the UI -->
|
<!-- This file allows you to define components to the UI -->
|
||||||
|
|
|
@ -24,15 +24,16 @@
|
||||||
xmlns:security="http://www.springframework.org/schema/security"
|
xmlns:security="http://www.springframework.org/schema/security"
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd
|
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.2.xsd
|
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
|
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd
|
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd">
|
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||||
|
|
||||||
<security:authentication-manager id="authenticationManager">
|
<security:authentication-manager id="authenticationManager">
|
||||||
<security:authentication-provider>
|
<security:authentication-provider>
|
||||||
<security:jdbc-user-service data-source-ref="dataSource"/>
|
<security:jdbc-user-service data-source-ref="dataSource"/>
|
||||||
|
<security:password-encoder ref="noOpPasswordEncoder"/>
|
||||||
</security:authentication-provider>
|
</security:authentication-provider>
|
||||||
</security:authentication-manager>
|
</security:authentication-manager>
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form name="confirmationForm"
|
<form name="confirmationForm"
|
||||||
action="${pageContext.request.contextPath.endsWith('/') ? pageContext.request.contextPath : pageContext.request.contextPath.concat('/') }authorize" method="post">
|
action="${ config.issuer }${ config.issuer.endsWith('/') ? '' : '/' }authorize" method="post">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span5 offset1 well-small" style="text-align: left">
|
<div class="span5 offset1 well-small" style="text-align: left">
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<form name="confirmationForm"
|
<form name="confirmationForm"
|
||||||
action="${pageContext.request.contextPath.endsWith('/') ? pageContext.request.contextPath : pageContext.request.contextPath.concat('/') }device/approve" method="post">
|
action="${ config.issuer }${ config.issuer.endsWith('/') ? '' : '/' }device/approve" method="post">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="span5 offset1 well-small" style="text-align: left">
|
<div class="span5 offset1 well-small" style="text-align: left">
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -304,7 +304,7 @@ public class DiscoveryEndpoint {
|
||||||
JWSAlgorithm.ES256, JWSAlgorithm.ES384, JWSAlgorithm.ES512,
|
JWSAlgorithm.ES256, JWSAlgorithm.ES384, JWSAlgorithm.ES512,
|
||||||
JWSAlgorithm.PS256, JWSAlgorithm.PS384, JWSAlgorithm.PS512,
|
JWSAlgorithm.PS256, JWSAlgorithm.PS384, JWSAlgorithm.PS512,
|
||||||
Algorithm.NONE);
|
Algorithm.NONE);
|
||||||
ArrayList<String> grantTypes = Lists.newArrayList("authorization_code", "implicit", "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "urn:ietf:params:oauth:grant_type:redelegate", "urn:ietf:params:oauth:grant-type:device_code");
|
ArrayList<String> grantTypes = Lists.newArrayList("authorization_code", "implicit", "urn:ietf:params:oauth:grant-type:jwt-bearer", "client_credentials", "urn:ietf:params:oauth:grant_type:redelegate", "urn:ietf:params:oauth:grant-type:device_code","refresh_token");
|
||||||
|
|
||||||
Map<String, Object> m = new HashMap<>();
|
Map<String, Object> m = new HashMap<>();
|
||||||
m.put("issuer", config.getIssuer());
|
m.put("issuer", config.getIssuer());
|
||||||
|
|
|
@ -103,9 +103,9 @@ public class OAuthConfirmationController {
|
||||||
|
|
||||||
@PreAuthorize("hasRole('ROLE_USER')")
|
@PreAuthorize("hasRole('ROLE_USER')")
|
||||||
@RequestMapping("/oauth/confirm_access")
|
@RequestMapping("/oauth/confirm_access")
|
||||||
public String confimAccess(Map<String, Object> model, @ModelAttribute("authorizationRequest") AuthorizationRequest authRequest,
|
public String confirmAccess(Map<String, Object> model, Principal p) {
|
||||||
Principal p) {
|
|
||||||
|
|
||||||
|
AuthorizationRequest authRequest = (AuthorizationRequest) model.get("authorizationRequest");
|
||||||
// Check the "prompt" parameter to see if we need to do special processing
|
// Check the "prompt" parameter to see if we need to do special processing
|
||||||
|
|
||||||
String prompt = (String)authRequest.getExtensions().get(PROMPT);
|
String prompt = (String)authRequest.getExtensions().get(PROMPT);
|
||||||
|
|
|
@ -19,21 +19,25 @@ package org.mitre.openid.connect.web;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.mitre.jwt.assertion.AssertionValidator;
|
import org.mitre.jwt.assertion.AssertionValidator;
|
||||||
import org.mitre.oauth2.model.ClientDetailsEntity;
|
import org.mitre.oauth2.model.ClientDetailsEntity;
|
||||||
|
import org.mitre.oauth2.model.ClientDetailsEntity.AppType;
|
||||||
import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod;
|
import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod;
|
||||||
|
import org.mitre.oauth2.model.ClientDetailsEntity.SubjectType;
|
||||||
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
|
import org.mitre.oauth2.model.OAuth2AccessTokenEntity;
|
||||||
import org.mitre.oauth2.model.RegisteredClient;
|
import org.mitre.oauth2.model.RegisteredClient;
|
||||||
|
import org.mitre.oauth2.model.SystemScope;
|
||||||
import org.mitre.oauth2.service.ClientDetailsEntityService;
|
import org.mitre.oauth2.service.ClientDetailsEntityService;
|
||||||
import org.mitre.oauth2.service.OAuth2TokenEntityService;
|
import org.mitre.oauth2.service.OAuth2TokenEntityService;
|
||||||
import org.mitre.oauth2.service.SystemScopeService;
|
import org.mitre.oauth2.service.SystemScopeService;
|
||||||
import org.mitre.openid.connect.ClientDetailsEntityJsonProcessor;
|
import org.mitre.openid.connect.ClientDetailsEntityJsonProcessor;
|
||||||
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
|
import org.mitre.openid.connect.config.ConfigurationPropertiesBean;
|
||||||
import org.mitre.openid.connect.exception.ValidationException;
|
import org.mitre.openid.connect.exception.ValidationException;
|
||||||
import org.mitre.openid.connect.service.DynamicClientValidationService;
|
import org.mitre.openid.connect.service.BlacklistedSiteService;
|
||||||
import org.mitre.openid.connect.service.OIDCTokenService;
|
import org.mitre.openid.connect.service.OIDCTokenService;
|
||||||
import org.mitre.openid.connect.view.ClientInformationResponseView;
|
import org.mitre.openid.connect.view.ClientInformationResponseView;
|
||||||
import org.mitre.openid.connect.view.HttpCodeView;
|
import org.mitre.openid.connect.view.HttpCodeView;
|
||||||
|
@ -45,6 +49,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.security.oauth2.common.util.OAuth2Utils;
|
||||||
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
import org.springframework.security.oauth2.provider.OAuth2Authentication;
|
||||||
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
|
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
|
@ -55,8 +60,54 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
import org.springframework.web.util.UriUtils;
|
import org.springframework.web.util.UriUtils;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
import com.nimbusds.jose.EncryptionMethod;
|
||||||
|
import com.nimbusds.jose.JWEAlgorithm;
|
||||||
|
import com.nimbusds.jose.JWSAlgorithm;
|
||||||
|
import com.nimbusds.jose.jwk.JWKSet;
|
||||||
|
import com.nimbusds.jwt.JWTClaimsSet;
|
||||||
|
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.APPLICATION_TYPE;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLAIMS_REDIRECT_URIS;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLIENT_ID;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLIENT_ID_ISSUED_AT;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLIENT_NAME;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLIENT_SECRET;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLIENT_SECRET_EXPIRES_AT;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CLIENT_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.CONTACTS;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.DEFAULT_ACR_VALUES;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.DEFAULT_MAX_AGE;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.GRANT_TYPES;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.ID_TOKEN_ENCRYPTED_RESPONSE_ALG;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.ID_TOKEN_ENCRYPTED_RESPONSE_ENC;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.ID_TOKEN_SIGNED_RESPONSE_ALG;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.INITIATE_LOGIN_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.JWKS;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.JWKS_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.LOGO_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.POLICY_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.POST_LOGOUT_REDIRECT_URIS;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.REDIRECT_URIS;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.REGISTRATION_ACCESS_TOKEN;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.REGISTRATION_CLIENT_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.REQUEST_OBJECT_SIGNING_ALG;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.REQUEST_URIS;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.REQUIRE_AUTH_TIME;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.RESPONSE_TYPES;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.SCOPE;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.SECTOR_IDENTIFIER_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.SOFTWARE_STATEMENT;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.SUBJECT_TYPE;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.TOKEN_ENDPOINT_AUTH_METHOD;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.TOKEN_ENDPOINT_AUTH_SIGNING_ALG;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.TOS_URI;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.USERINFO_ENCRYPTED_RESPONSE_ALG;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.USERINFO_ENCRYPTED_RESPONSE_ENC;
|
||||||
|
import static org.mitre.oauth2.model.RegisteredClientFields.USERINFO_SIGNED_RESPONSE_ALG;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping(value = DynamicClientRegistrationEndpoint.URL)
|
@RequestMapping(value = DynamicClientRegistrationEndpoint.URL)
|
||||||
|
@ -70,15 +121,18 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
@Autowired
|
@Autowired
|
||||||
private OAuth2TokenEntityService tokenService;
|
private OAuth2TokenEntityService tokenService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SystemScopeService scopeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BlacklistedSiteService blacklistService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ConfigurationPropertiesBean config;
|
private ConfigurationPropertiesBean config;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private OIDCTokenService connectTokenService;
|
private OIDCTokenService connectTokenService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private DynamicClientValidationService clientValidationService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
@Qualifier("clientAssertionValidator")
|
@Qualifier("clientAssertionValidator")
|
||||||
private AssertionValidator assertionValidator;
|
private AssertionValidator assertionValidator;
|
||||||
|
@ -86,24 +140,16 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
/**
|
/**
|
||||||
* Logger for this class
|
* Logger for this class
|
||||||
*/
|
*/
|
||||||
private static final Logger logger =
|
private static final Logger logger = LoggerFactory.getLogger(DynamicClientRegistrationEndpoint.class);
|
||||||
LoggerFactory.getLogger(DynamicClientRegistrationEndpoint.class);
|
|
||||||
|
|
||||||
public static final ImmutableSet<String> ALLOWED_GRANT_TYPES =
|
|
||||||
ImmutableSet.of("authorization_code", "implicit", "client_credentials", "refresh_token",
|
|
||||||
"urn:ietf:params:oauth:grant_type:redelegate",
|
|
||||||
"urn:ietf:params:oauth:grant-type:device_code");
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Client, issue a client ID, and create a registration access token.
|
* Create a new Client, issue a client ID, and create a registration access token.
|
||||||
*
|
|
||||||
* @param jsonString
|
* @param jsonString
|
||||||
* @param m
|
* @param m
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE,
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String registerNewClient(@RequestBody String jsonString, Model m) {
|
public String registerNewClient(@RequestBody String jsonString, Model m) {
|
||||||
|
|
||||||
ClientDetailsEntity newClient = null;
|
ClientDetailsEntity newClient = null;
|
||||||
|
@ -128,13 +174,14 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
newClient.setClientId(null);
|
newClient.setClientId(null);
|
||||||
newClient.setClientSecret(null);
|
newClient.setClientSecret(null);
|
||||||
|
|
||||||
Set<String> requestedGrantTypes = newClient.getGrantTypes();
|
|
||||||
requestedGrantTypes.retainAll(ALLOWED_GRANT_TYPES);
|
|
||||||
newClient.setGrantTypes(requestedGrantTypes);
|
|
||||||
|
|
||||||
// do validation on the fields
|
// do validation on the fields
|
||||||
try {
|
try {
|
||||||
newClient = clientValidationService.validateClient(newClient);
|
newClient = validateSoftwareStatement(newClient); // need to handle the software statement first because it might override requested values
|
||||||
|
newClient = validateScopes(newClient);
|
||||||
|
newClient = validateResponseTypes(newClient);
|
||||||
|
newClient = validateGrantTypes(newClient);
|
||||||
|
newClient = validateRedirectUris(newClient);
|
||||||
|
newClient = validateAuth(newClient);
|
||||||
} catch (ValidationException ve) {
|
} catch (ValidationException ve) {
|
||||||
// validation failed, return an error
|
// validation failed, return an error
|
||||||
m.addAttribute(JsonErrorView.ERROR, ve.getError());
|
m.addAttribute(JsonErrorView.ERROR, ve.getError());
|
||||||
|
@ -147,9 +194,9 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
newClient.setTokenEndpointAuthMethod(AuthMethod.SECRET_BASIC);
|
newClient.setTokenEndpointAuthMethod(AuthMethod.SECRET_BASIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_BASIC
|
if (newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_BASIC ||
|
||||||
|| newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_JWT
|
newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_JWT ||
|
||||||
|| newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_POST) {
|
newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_POST) {
|
||||||
|
|
||||||
// we need to generate a secret
|
// we need to generate a secret
|
||||||
newClient = clientService.generateClientSecret(newClient);
|
newClient = clientService.generateClientSecret(newClient);
|
||||||
|
@ -159,40 +206,24 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
if (config.isHeartMode()) {
|
if (config.isHeartMode()) {
|
||||||
// heart mode has different defaults depending on primary grant type
|
// heart mode has different defaults depending on primary grant type
|
||||||
if (newClient.getGrantTypes().contains("authorization_code")) {
|
if (newClient.getGrantTypes().contains("authorization_code")) {
|
||||||
newClient.setAccessTokenValiditySeconds((int) TimeUnit.HOURS.toSeconds(1)); // access
|
newClient.setAccessTokenValiditySeconds((int)TimeUnit.HOURS.toSeconds(1)); // access tokens good for 1hr
|
||||||
// tokens good
|
newClient.setIdTokenValiditySeconds((int)TimeUnit.MINUTES.toSeconds(5)); // id tokens good for 5min
|
||||||
// for 1hr
|
newClient.setRefreshTokenValiditySeconds((int)TimeUnit.HOURS.toSeconds(24)); // refresh tokens good for 24hr
|
||||||
newClient.setIdTokenValiditySeconds((int) TimeUnit.MINUTES.toSeconds(5)); // id tokens
|
|
||||||
// good for 5min
|
|
||||||
newClient.setRefreshTokenValiditySeconds((int) TimeUnit.HOURS.toSeconds(24)); // refresh
|
|
||||||
// tokens
|
|
||||||
// good for
|
|
||||||
// 24hr
|
|
||||||
} else if (newClient.getGrantTypes().contains("implicit")) {
|
} else if (newClient.getGrantTypes().contains("implicit")) {
|
||||||
newClient.setAccessTokenValiditySeconds((int) TimeUnit.MINUTES.toSeconds(15)); // access
|
newClient.setAccessTokenValiditySeconds((int)TimeUnit.MINUTES.toSeconds(15)); // access tokens good for 15min
|
||||||
// tokens
|
newClient.setIdTokenValiditySeconds((int)TimeUnit.MINUTES.toSeconds(5)); // id tokens good for 5min
|
||||||
// good for
|
|
||||||
// 15min
|
|
||||||
newClient.setIdTokenValiditySeconds((int) TimeUnit.MINUTES.toSeconds(5)); // id tokens
|
|
||||||
// good for 5min
|
|
||||||
newClient.setRefreshTokenValiditySeconds(0); // no refresh tokens
|
newClient.setRefreshTokenValiditySeconds(0); // no refresh tokens
|
||||||
} else if (newClient.getGrantTypes().contains("client_credentials")) {
|
} else if (newClient.getGrantTypes().contains("client_credentials")) {
|
||||||
newClient.setAccessTokenValiditySeconds((int) TimeUnit.HOURS.toSeconds(6)); // access
|
newClient.setAccessTokenValiditySeconds((int)TimeUnit.HOURS.toSeconds(6)); // access tokens good for 6hr
|
||||||
// tokens good
|
|
||||||
// for 6hr
|
|
||||||
newClient.setIdTokenValiditySeconds(0); // no id tokens
|
newClient.setIdTokenValiditySeconds(0); // no id tokens
|
||||||
newClient.setRefreshTokenValiditySeconds(0); // no refresh tokens
|
newClient.setRefreshTokenValiditySeconds(0); // no refresh tokens
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
newClient.setAccessTokenValiditySeconds((int) TimeUnit.HOURS.toSeconds(1)); // access tokens
|
newClient.setAccessTokenValiditySeconds((int)TimeUnit.HOURS.toSeconds(1)); // access tokens good for 1hr
|
||||||
// good for 1hr
|
newClient.setIdTokenValiditySeconds((int)TimeUnit.MINUTES.toSeconds(10)); // id tokens good for 10min
|
||||||
newClient.setIdTokenValiditySeconds((int) TimeUnit.MINUTES.toSeconds(10)); // id tokens good
|
|
||||||
// for 10min
|
|
||||||
newClient.setRefreshTokenValiditySeconds(null); // refresh tokens good until revoked
|
newClient.setRefreshTokenValiditySeconds(null); // refresh tokens good until revoked
|
||||||
newClient.setDeviceCodeValiditySeconds((int) TimeUnit.MINUTES.toSeconds(10));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// this client has been dynamically registered (obviously)
|
// this client has been dynamically registered (obviously)
|
||||||
newClient.setDynamicallyRegistered(true);
|
newClient.setDynamicallyRegistered(true);
|
||||||
|
|
||||||
|
@ -204,15 +235,12 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
ClientDetailsEntity savedClient = clientService.saveNewClient(newClient);
|
ClientDetailsEntity savedClient = clientService.saveNewClient(newClient);
|
||||||
|
|
||||||
// generate the registration access token
|
// generate the registration access token
|
||||||
OAuth2AccessTokenEntity token =
|
OAuth2AccessTokenEntity token = connectTokenService.createRegistrationAccessToken(savedClient);
|
||||||
connectTokenService.createRegistrationAccessToken(savedClient);
|
|
||||||
token = tokenService.saveAccessToken(token);
|
token = tokenService.saveAccessToken(token);
|
||||||
|
|
||||||
// send it all out to the view
|
// send it all out to the view
|
||||||
|
|
||||||
RegisteredClient registered =
|
RegisteredClient registered = new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "register/" + UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
||||||
new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "register/"
|
|
||||||
+ UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
|
||||||
m.addAttribute("client", registered);
|
m.addAttribute("client", registered);
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.CREATED); // http 201
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.CREATED); // http 201
|
||||||
|
|
||||||
|
@ -221,8 +249,7 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
logger.error("Couldn't save client", e);
|
logger.error("Couldn't save client", e);
|
||||||
|
|
||||||
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
||||||
m.addAttribute(JsonErrorView.ERROR_MESSAGE,
|
m.addAttribute(JsonErrorView.ERROR_MESSAGE, "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
"Unable to save client due to invalid or inconsistent metadata.");
|
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
return JsonErrorView.VIEWNAME;
|
return JsonErrorView.VIEWNAME;
|
||||||
|
@ -239,22 +266,19 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the meta information for a client.
|
* Get the meta information for a client.
|
||||||
*
|
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @param m
|
* @param m
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('"
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
||||||
+ SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET,
|
public String readClientConfiguration(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String readClientConfiguration(@PathVariable("id") String clientId, Model m,
|
|
||||||
OAuth2Authentication auth) {
|
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
if (client != null && client.getClientId().equals(auth.getOAuth2Request().getClientId())) {
|
if (client != null && client.getClientId().equals(auth.getOAuth2Request().getClientId())) {
|
||||||
|
|
||||||
OAuth2AccessTokenEntity token = rotateRegistrationTokenIfNecessary(auth, client);
|
OAuth2AccessTokenEntity token = rotateRegistrationTokenIfNecessary(auth, client);
|
||||||
RegisteredClient registered =
|
RegisteredClient registered =
|
||||||
new RegisteredClient(client, token.getValue(), config.getIssuer() + "register/"
|
new RegisteredClient(client, token.getValue(), config.getIssuer() + "register/"
|
||||||
|
@ -268,8 +292,8 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
logger.error("readClientConfiguration failed, client ID mismatch: " + clientId + " and "
|
logger.error("readClientConfiguration failed, client ID mismatch: "
|
||||||
+ auth.getOAuth2Request().getClientId() + " do not match.");
|
+ clientId + " and " + auth.getOAuth2Request().getClientId() + " do not match.");
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
||||||
|
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
|
@ -278,19 +302,15 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the metainformation for a given client.
|
* Update the metainformation for a given client.
|
||||||
*
|
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @param jsonString
|
* @param jsonString
|
||||||
* @param m
|
* @param m
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('"
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
||||||
+ SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT,
|
public String updateClient(@PathVariable("id") String clientId, @RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String updateClient(@PathVariable("id") String clientId, @RequestBody String jsonString,
|
|
||||||
Model m, OAuth2Authentication auth) {
|
|
||||||
|
|
||||||
|
|
||||||
ClientDetailsEntity newClient = null;
|
ClientDetailsEntity newClient = null;
|
||||||
|
@ -306,12 +326,8 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
ClientDetailsEntity oldClient = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity oldClient = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
if (newClient != null && oldClient != null // we have an existing client and the new one parsed
|
if (newClient != null && oldClient != null // we have an existing client and the new one parsed
|
||||||
&& oldClient.getClientId().equals(auth.getOAuth2Request().getClientId()) // the client
|
&& oldClient.getClientId().equals(auth.getOAuth2Request().getClientId()) // the client passed in the URI matches the one in the auth
|
||||||
// passed in the
|
&& oldClient.getClientId().equals(newClient.getClientId()) // the client passed in the body matches the one in the URI
|
||||||
// URI matches the
|
|
||||||
// one in the auth
|
|
||||||
&& oldClient.getClientId().equals(newClient.getClientId()) // the client passed in the body
|
|
||||||
// matches the one in the URI
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// a client can't ask to update its own client secret to any particular value
|
// a client can't ask to update its own client secret to any particular value
|
||||||
|
@ -321,26 +337,21 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
newClient.setAccessTokenValiditySeconds(oldClient.getAccessTokenValiditySeconds());
|
newClient.setAccessTokenValiditySeconds(oldClient.getAccessTokenValiditySeconds());
|
||||||
newClient.setIdTokenValiditySeconds(oldClient.getIdTokenValiditySeconds());
|
newClient.setIdTokenValiditySeconds(oldClient.getIdTokenValiditySeconds());
|
||||||
newClient.setRefreshTokenValiditySeconds(oldClient.getRefreshTokenValiditySeconds());
|
newClient.setRefreshTokenValiditySeconds(oldClient.getRefreshTokenValiditySeconds());
|
||||||
newClient.setDeviceCodeValiditySeconds(oldClient.getDeviceCodeValiditySeconds());
|
|
||||||
newClient.setDynamicallyRegistered(true); // it's still dynamically registered
|
newClient.setDynamicallyRegistered(true); // it's still dynamically registered
|
||||||
newClient.setAllowIntrospection(false); // dynamically registered clients can't do
|
newClient.setAllowIntrospection(false); // dynamically registered clients can't do introspection -- use the resource registration instead
|
||||||
// introspection -- use the resource registration
|
|
||||||
// instead
|
|
||||||
newClient.setAuthorities(oldClient.getAuthorities());
|
newClient.setAuthorities(oldClient.getAuthorities());
|
||||||
newClient.setClientDescription(oldClient.getClientDescription());
|
newClient.setClientDescription(oldClient.getClientDescription());
|
||||||
newClient.setCreatedAt(oldClient.getCreatedAt());
|
newClient.setCreatedAt(oldClient.getCreatedAt());
|
||||||
newClient.setReuseRefreshToken(oldClient.isReuseRefreshToken());
|
newClient.setReuseRefreshToken(oldClient.isReuseRefreshToken());
|
||||||
|
|
||||||
Set<String> requestedGrantTypes = newClient.getGrantTypes();
|
|
||||||
requestedGrantTypes.retainAll(ALLOWED_GRANT_TYPES);
|
|
||||||
newClient.setGrantTypes(requestedGrantTypes);
|
|
||||||
|
|
||||||
Set<String> oldClientGrantedGrantTypes = oldClient.getGrantTypes();
|
|
||||||
oldClientGrantedGrantTypes.removeAll(ALLOWED_GRANT_TYPES);
|
|
||||||
|
|
||||||
// do validation on the fields
|
// do validation on the fields
|
||||||
try {
|
try {
|
||||||
newClient = clientValidationService.validateClient(newClient);
|
newClient = validateSoftwareStatement(newClient); // need to handle the software statement first because it might override requested values
|
||||||
|
newClient = validateScopes(newClient);
|
||||||
|
newClient = validateResponseTypes(newClient);
|
||||||
|
newClient = validateGrantTypes(newClient);
|
||||||
|
newClient = validateRedirectUris(newClient);
|
||||||
|
newClient = validateAuth(newClient);
|
||||||
} catch (ValidationException ve) {
|
} catch (ValidationException ve) {
|
||||||
// validation failed, return an error
|
// validation failed, return an error
|
||||||
m.addAttribute(JsonErrorView.ERROR, ve.getError());
|
m.addAttribute(JsonErrorView.ERROR, ve.getError());
|
||||||
|
@ -350,18 +361,12 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (!oldClientGrantedGrantTypes.isEmpty()) {
|
|
||||||
newClient.getGrantTypes().addAll(oldClientGrantedGrantTypes);
|
|
||||||
}
|
|
||||||
// save the client
|
// save the client
|
||||||
ClientDetailsEntity savedClient = clientService.updateClient(oldClient, newClient);
|
ClientDetailsEntity savedClient = clientService.updateClient(oldClient, newClient);
|
||||||
|
|
||||||
OAuth2AccessTokenEntity token = rotateRegistrationTokenIfNecessary(auth, savedClient);
|
OAuth2AccessTokenEntity token = rotateRegistrationTokenIfNecessary(auth, savedClient);
|
||||||
|
|
||||||
RegisteredClient registered =
|
RegisteredClient registered = new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "register/" + UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
||||||
new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "register/"
|
|
||||||
+ UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
|
||||||
|
|
||||||
// send it all out to the view
|
// send it all out to the view
|
||||||
m.addAttribute("client", registered);
|
m.addAttribute("client", registered);
|
||||||
|
@ -372,16 +377,15 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
logger.error("Couldn't save client", e);
|
logger.error("Couldn't save client", e);
|
||||||
|
|
||||||
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
||||||
m.addAttribute(JsonErrorView.ERROR_MESSAGE,
|
m.addAttribute(JsonErrorView.ERROR_MESSAGE, "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
"Unable to save client due to invalid or inconsistent metadata.");
|
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
return JsonErrorView.VIEWNAME;
|
return JsonErrorView.VIEWNAME;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
logger.error("updateClient failed, client ID mismatch: " + clientId + " and "
|
logger.error("updateClient failed, client ID mismatch: "
|
||||||
+ auth.getOAuth2Request().getClientId() + " do not match.");
|
+ clientId + " and " + auth.getOAuth2Request().getClientId() + " do not match.");
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
||||||
|
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
|
@ -390,18 +394,14 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the indicated client from the system.
|
* Delete the indicated client from the system.
|
||||||
*
|
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @param m
|
* @param m
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('"
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
||||||
+ SystemScopeService.REGISTRATION_TOKEN_SCOPE + "')")
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE,
|
public String deleteClient(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String deleteClient(@PathVariable("id") String clientId, Model m,
|
|
||||||
OAuth2Authentication auth) {
|
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
|
@ -414,19 +414,333 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
logger.error("readClientConfiguration failed, client ID mismatch: " + clientId + " and "
|
logger.error("readClientConfiguration failed, client ID mismatch: "
|
||||||
+ auth.getOAuth2Request().getClientId() + " do not match.");
|
+ clientId + " and " + auth.getOAuth2Request().getClientId() + " do not match.");
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
||||||
|
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ClientDetailsEntity validateScopes(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
|
// scopes that the client is asking for
|
||||||
|
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
|
||||||
|
|
||||||
|
// the scopes that the client can have must be a subset of the dynamically allowed scopes
|
||||||
|
Set<SystemScope> allowedScopes = scopeService.removeRestrictedAndReservedScopes(requestedScopes);
|
||||||
|
|
||||||
|
// if the client didn't ask for any, give them the defaults
|
||||||
|
if (allowedScopes == null || allowedScopes.isEmpty()) {
|
||||||
|
allowedScopes = scopeService.getDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
newClient.setScope(scopeService.toStrings(allowedScopes));
|
||||||
|
|
||||||
|
return newClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClientDetailsEntity validateResponseTypes(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
|
if (newClient.getResponseTypes() == null) {
|
||||||
|
newClient.setResponseTypes(new HashSet<String>());
|
||||||
|
}
|
||||||
|
return newClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClientDetailsEntity validateGrantTypes(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
|
// set default grant types if needed
|
||||||
|
if (newClient.getGrantTypes() == null || newClient.getGrantTypes().isEmpty()) {
|
||||||
|
if (newClient.getScope().contains("offline_access")) { // client asked for offline access
|
||||||
|
newClient.setGrantTypes(Sets.newHashSet("authorization_code", "refresh_token")); // allow authorization code and refresh token grant types by default
|
||||||
|
} else {
|
||||||
|
newClient.setGrantTypes(Sets.newHashSet("authorization_code")); // allow authorization code grant type by default
|
||||||
|
}
|
||||||
|
if (config.isDualClient()) {
|
||||||
|
Set<String> extendedGrandTypes = newClient.getGrantTypes();
|
||||||
|
extendedGrandTypes.add("client_credentials");
|
||||||
|
newClient.setGrantTypes(extendedGrandTypes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// filter out unknown grant types
|
||||||
|
// TODO: make this a pluggable service
|
||||||
|
Set<String> requestedGrantTypes = new HashSet<>(newClient.getGrantTypes());
|
||||||
|
requestedGrantTypes.retainAll(
|
||||||
|
ImmutableSet.of("authorization_code", "implicit",
|
||||||
|
"password", "client_credentials", "refresh_token",
|
||||||
|
"urn:ietf:params:oauth:grant_type:redelegate"));
|
||||||
|
|
||||||
|
// don't allow "password" grant type for dynamic registration
|
||||||
|
if (newClient.getGrantTypes().contains("password")) {
|
||||||
|
// return an error, you can't dynamically register for the password grant
|
||||||
|
throw new ValidationException("invalid_client_metadata", "The password grant type is not allowed in dynamic registration on this server.", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't allow clients to have multiple incompatible grant types and scopes
|
||||||
|
if (newClient.getGrantTypes().contains("authorization_code")) {
|
||||||
|
|
||||||
|
// check for incompatible grants
|
||||||
|
if (newClient.getGrantTypes().contains("implicit") ||
|
||||||
|
(!config.isDualClient() && newClient.getGrantTypes().contains("client_credentials"))) {
|
||||||
|
// return an error, you can't have these grant types together
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Incompatible grant types requested: " + newClient.getGrantTypes(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClient.getResponseTypes().contains("token")) {
|
||||||
|
// return an error, you can't have this grant type and response type together
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Incompatible response types requested: " + newClient.getGrantTypes() + " / " + newClient.getResponseTypes(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
newClient.getResponseTypes().add("code");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClient.getGrantTypes().contains("implicit")) {
|
||||||
|
|
||||||
|
// check for incompatible grants
|
||||||
|
if (newClient.getGrantTypes().contains("authorization_code") ||
|
||||||
|
(!config.isDualClient() && newClient.getGrantTypes().contains("client_credentials"))) {
|
||||||
|
// return an error, you can't have these grant types together
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Incompatible grant types requested: " + newClient.getGrantTypes(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClient.getResponseTypes().contains("code")) {
|
||||||
|
// return an error, you can't have this grant type and response type together
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Incompatible response types requested: " + newClient.getGrantTypes() + " / " + newClient.getResponseTypes(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
newClient.getResponseTypes().add("token");
|
||||||
|
|
||||||
|
// don't allow refresh tokens in implicit clients
|
||||||
|
newClient.getGrantTypes().remove("refresh_token");
|
||||||
|
newClient.getScope().remove(SystemScopeService.OFFLINE_ACCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClient.getGrantTypes().contains("client_credentials")) {
|
||||||
|
|
||||||
|
// check for incompatible grants
|
||||||
|
if (!config.isDualClient() &&
|
||||||
|
(newClient.getGrantTypes().contains("authorization_code") || newClient.getGrantTypes().contains("implicit"))) {
|
||||||
|
// return an error, you can't have these grant types together
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Incompatible grant types requested: " + newClient.getGrantTypes(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!newClient.getResponseTypes().isEmpty()) {
|
||||||
|
// return an error, you can't have this grant type and response type together
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Incompatible response types requested: " + newClient.getGrantTypes() + " / " + newClient.getResponseTypes(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't allow refresh tokens or id tokens in client_credentials clients
|
||||||
|
newClient.getGrantTypes().remove("refresh_token");
|
||||||
|
newClient.getScope().remove(SystemScopeService.OFFLINE_ACCESS);
|
||||||
|
newClient.getScope().remove(SystemScopeService.OPENID_SCOPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClient.getGrantTypes().isEmpty()) {
|
||||||
|
// return an error, you need at least one grant type selected
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Clients must register at least one grant type.", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
return newClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClientDetailsEntity validateRedirectUris(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
|
// check to make sure this client registered a redirect URI if using a redirect flow
|
||||||
|
if (newClient.getGrantTypes().contains("authorization_code") || newClient.getGrantTypes().contains("implicit")) {
|
||||||
|
if (newClient.getRedirectUris() == null || newClient.getRedirectUris().isEmpty()) {
|
||||||
|
// return an error
|
||||||
|
throw new ValidationException("invalid_redirect_uri", "Clients using a redirect-based grant type must register at least one redirect URI.", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String uri : newClient.getRedirectUris()) {
|
||||||
|
if (blacklistService.isBlacklisted(uri)) {
|
||||||
|
// return an error
|
||||||
|
throw new ValidationException("invalid_redirect_uri", "Redirect URI is not allowed: " + uri, HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uri.contains("#")) {
|
||||||
|
// if it contains the hash symbol then it has a fragment, which isn't allowed
|
||||||
|
throw new ValidationException("invalid_redirect_uri", "Redirect URI can not have a fragment", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ClientDetailsEntity validateAuth(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
|
if (newClient.getTokenEndpointAuthMethod() == null) {
|
||||||
|
newClient.setTokenEndpointAuthMethod(AuthMethod.SECRET_BASIC);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_BASIC ||
|
||||||
|
newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_JWT ||
|
||||||
|
newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_POST) {
|
||||||
|
|
||||||
|
if (Strings.isNullOrEmpty(newClient.getClientSecret())) {
|
||||||
|
// no secret yet, we need to generate a secret
|
||||||
|
newClient = clientService.generateClientSecret(newClient);
|
||||||
|
}
|
||||||
|
} else if (newClient.getTokenEndpointAuthMethod() == AuthMethod.PRIVATE_KEY) {
|
||||||
|
if (Strings.isNullOrEmpty(newClient.getJwksUri()) && newClient.getJwks() == null) {
|
||||||
|
throw new ValidationException("invalid_client_metadata", "JWK Set URI required when using private key authentication", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
newClient.setClientSecret(null);
|
||||||
|
} else if (newClient.getTokenEndpointAuthMethod() == AuthMethod.NONE) {
|
||||||
|
newClient.setClientSecret(null);
|
||||||
|
} else {
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Unknown authentication method", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
return newClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param newClient
|
||||||
|
* @return
|
||||||
|
* @throws ValidationException
|
||||||
|
*/
|
||||||
|
private ClientDetailsEntity validateSoftwareStatement(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
|
if (newClient.getSoftwareStatement() != null) {
|
||||||
|
if (assertionValidator.isValid(newClient.getSoftwareStatement())) {
|
||||||
|
// we have a software statement and its envelope passed all the checks from our validator
|
||||||
|
|
||||||
|
// swap out all of the client's fields for the associated parts of the software statement
|
||||||
|
try {
|
||||||
|
JWTClaimsSet claimSet = newClient.getSoftwareStatement().getJWTClaimsSet();
|
||||||
|
for (String claim : claimSet.getClaims().keySet()) {
|
||||||
|
switch (claim) {
|
||||||
|
case SOFTWARE_STATEMENT:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't include another software statement", HttpStatus.BAD_REQUEST);
|
||||||
|
case CLAIMS_REDIRECT_URIS:
|
||||||
|
newClient.setClaimsRedirectUris(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case CLIENT_SECRET_EXPIRES_AT:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't include a client secret expiration time", HttpStatus.BAD_REQUEST);
|
||||||
|
case CLIENT_ID_ISSUED_AT:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't include a client ID issuance time", HttpStatus.BAD_REQUEST);
|
||||||
|
case REGISTRATION_CLIENT_URI:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't include a client configuration endpoint", HttpStatus.BAD_REQUEST);
|
||||||
|
case REGISTRATION_ACCESS_TOKEN:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't include a client registration access token", HttpStatus.BAD_REQUEST);
|
||||||
|
case REQUEST_URIS:
|
||||||
|
newClient.setRequestUris(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case POST_LOGOUT_REDIRECT_URIS:
|
||||||
|
newClient.setPostLogoutRedirectUris(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case INITIATE_LOGIN_URI:
|
||||||
|
newClient.setInitiateLoginUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case DEFAULT_ACR_VALUES:
|
||||||
|
newClient.setDefaultACRvalues(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case REQUIRE_AUTH_TIME:
|
||||||
|
newClient.setRequireAuthTime(claimSet.getBooleanClaim(claim));
|
||||||
|
break;
|
||||||
|
case DEFAULT_MAX_AGE:
|
||||||
|
newClient.setDefaultMaxAge(claimSet.getIntegerClaim(claim));
|
||||||
|
break;
|
||||||
|
case TOKEN_ENDPOINT_AUTH_SIGNING_ALG:
|
||||||
|
newClient.setTokenEndpointAuthSigningAlg(JWSAlgorithm.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case ID_TOKEN_ENCRYPTED_RESPONSE_ENC:
|
||||||
|
newClient.setIdTokenEncryptedResponseEnc(EncryptionMethod.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case ID_TOKEN_ENCRYPTED_RESPONSE_ALG:
|
||||||
|
newClient.setIdTokenEncryptedResponseAlg(JWEAlgorithm.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case ID_TOKEN_SIGNED_RESPONSE_ALG:
|
||||||
|
newClient.setIdTokenSignedResponseAlg(JWSAlgorithm.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case USERINFO_ENCRYPTED_RESPONSE_ENC:
|
||||||
|
newClient.setUserInfoEncryptedResponseEnc(EncryptionMethod.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case USERINFO_ENCRYPTED_RESPONSE_ALG:
|
||||||
|
newClient.setUserInfoEncryptedResponseAlg(JWEAlgorithm.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case USERINFO_SIGNED_RESPONSE_ALG:
|
||||||
|
newClient.setUserInfoSignedResponseAlg(JWSAlgorithm.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case REQUEST_OBJECT_SIGNING_ALG:
|
||||||
|
newClient.setRequestObjectSigningAlg(JWSAlgorithm.parse(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case SUBJECT_TYPE:
|
||||||
|
newClient.setSubjectType(SubjectType.getByValue(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case SECTOR_IDENTIFIER_URI:
|
||||||
|
newClient.setSectorIdentifierUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case APPLICATION_TYPE:
|
||||||
|
newClient.setApplicationType(AppType.getByValue(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case JWKS_URI:
|
||||||
|
newClient.setJwksUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case JWKS:
|
||||||
|
newClient.setJwks(JWKSet.parse(claimSet.getJSONObjectClaim(claim).toJSONString()));
|
||||||
|
break;
|
||||||
|
case POLICY_URI:
|
||||||
|
newClient.setPolicyUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case RESPONSE_TYPES:
|
||||||
|
newClient.setResponseTypes(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case GRANT_TYPES:
|
||||||
|
newClient.setGrantTypes(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case SCOPE:
|
||||||
|
newClient.setScope(OAuth2Utils.parseParameterList(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case TOKEN_ENDPOINT_AUTH_METHOD:
|
||||||
|
newClient.setTokenEndpointAuthMethod(AuthMethod.getByValue(claimSet.getStringClaim(claim)));
|
||||||
|
break;
|
||||||
|
case TOS_URI:
|
||||||
|
newClient.setTosUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case CONTACTS:
|
||||||
|
newClient.setContacts(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case LOGO_URI:
|
||||||
|
newClient.setLogoUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case CLIENT_URI:
|
||||||
|
newClient.setClientUri(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case CLIENT_NAME:
|
||||||
|
newClient.setClientName(claimSet.getStringClaim(claim));
|
||||||
|
break;
|
||||||
|
case REDIRECT_URIS:
|
||||||
|
newClient.setRedirectUris(Sets.newHashSet(claimSet.getStringListClaim(claim)));
|
||||||
|
break;
|
||||||
|
case CLIENT_SECRET:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't contain client secret", HttpStatus.BAD_REQUEST);
|
||||||
|
case CLIENT_ID:
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement can't contain client ID", HttpStatus.BAD_REQUEST);
|
||||||
|
|
||||||
|
default:
|
||||||
|
logger.warn("Software statement contained unknown field: " + claim + " with value " + claimSet.getClaim(claim));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return newClient;
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement claims didn't parse", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new ValidationException("invalid_client_metadata", "Software statement rejected by validator", HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// nothing to see here, carry on
|
||||||
|
return newClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Rotates the registration token if it's expired, otherwise returns it
|
* Rotates the registration token if it's expired, otherwise returns it
|
||||||
*/
|
*/
|
||||||
private OAuth2AccessTokenEntity rotateRegistrationTokenIfNecessary(OAuth2Authentication auth,
|
private OAuth2AccessTokenEntity rotateRegistrationTokenIfNecessary(OAuth2Authentication auth, ClientDetailsEntity client) {
|
||||||
ClientDetailsEntity client) {
|
|
||||||
|
|
||||||
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
|
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
|
||||||
OAuth2AccessTokenEntity token = tokenService.readAccessToken(details.getTokenValue());
|
OAuth2AccessTokenEntity token = tokenService.readAccessToken(details.getTokenValue());
|
||||||
|
@ -435,13 +749,11 @@ public class DynamicClientRegistrationEndpoint {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Re-issue the token if it has been issued before [currentTime - validity]
|
// Re-issue the token if it has been issued before [currentTime - validity]
|
||||||
Date validToDate =
|
Date validToDate = new Date(System.currentTimeMillis() - config.getRegTokenLifeTime() * 1000);
|
||||||
new Date(System.currentTimeMillis() - config.getRegTokenLifeTime() * 1000);
|
|
||||||
if(token.getJwt().getJWTClaimsSet().getIssueTime().before(validToDate)) {
|
if(token.getJwt().getJWTClaimsSet().getIssueTime().before(validToDate)) {
|
||||||
logger.info("Rotating the registration access token for " + client.getClientId());
|
logger.info("Rotating the registration access token for " + client.getClientId());
|
||||||
tokenService.revokeAccessToken(token);
|
tokenService.revokeAccessToken(token);
|
||||||
OAuth2AccessTokenEntity newToken =
|
OAuth2AccessTokenEntity newToken = connectTokenService.createRegistrationAccessToken(client);
|
||||||
connectTokenService.createRegistrationAccessToken(client);
|
|
||||||
tokenService.saveAccessToken(newToken);
|
tokenService.saveAccessToken(newToken);
|
||||||
return newToken;
|
return newToken;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -81,19 +81,16 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
/**
|
/**
|
||||||
* Logger for this class
|
* Logger for this class
|
||||||
*/
|
*/
|
||||||
private static final Logger logger =
|
private static final Logger logger = LoggerFactory.getLogger(ProtectedResourceRegistrationEndpoint.class);
|
||||||
LoggerFactory.getLogger(ProtectedResourceRegistrationEndpoint.class);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new Client, issue a client ID, and create a registration access token.
|
* Create a new Client, issue a client ID, and create a registration access token.
|
||||||
*
|
|
||||||
* @param jsonString
|
* @param jsonString
|
||||||
* @param m
|
* @param m
|
||||||
* @param p
|
* @param p
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE,
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String registerNewProtectedResource(@RequestBody String jsonString, Model m) {
|
public String registerNewProtectedResource(@RequestBody String jsonString, Model m) {
|
||||||
|
|
||||||
ClientDetailsEntity newClient = null;
|
ClientDetailsEntity newClient = null;
|
||||||
|
@ -174,9 +171,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
// send it all out to the view
|
// send it all out to the view
|
||||||
|
|
||||||
RegisteredClient registered =
|
RegisteredClient registered = new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "resource/" + UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
||||||
new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "resource/"
|
|
||||||
+ UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
|
||||||
m.addAttribute("client", registered);
|
m.addAttribute("client", registered);
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.CREATED); // http 201
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.CREATED); // http 201
|
||||||
|
|
||||||
|
@ -185,8 +180,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
logger.error("Couldn't save client", e);
|
logger.error("Couldn't save client", e);
|
||||||
|
|
||||||
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
||||||
m.addAttribute(JsonErrorView.ERROR_MESSAGE,
|
m.addAttribute(JsonErrorView.ERROR_MESSAGE, "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
"Unable to save client due to invalid or inconsistent metadata.");
|
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
return JsonErrorView.VIEWNAME;
|
return JsonErrorView.VIEWNAME;
|
||||||
|
@ -201,14 +195,12 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientDetailsEntity validateScopes(ClientDetailsEntity newClient)
|
private ClientDetailsEntity validateScopes(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
throws ValidationException {
|
|
||||||
// scopes that the client is asking for
|
// scopes that the client is asking for
|
||||||
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
|
Set<SystemScope> requestedScopes = scopeService.fromStrings(newClient.getScope());
|
||||||
|
|
||||||
// the scopes that the client can have must be a subset of the dynamically allowed scopes
|
// the scopes that the client can have must be a subset of the dynamically allowed scopes
|
||||||
Set<SystemScope> allowedScopes =
|
Set<SystemScope> allowedScopes = scopeService.removeRestrictedAndReservedScopes(requestedScopes);
|
||||||
scopeService.removeRestrictedAndReservedScopes(requestedScopes);
|
|
||||||
|
|
||||||
// if the client didn't ask for any, give them the defaults
|
// if the client didn't ask for any, give them the defaults
|
||||||
if (allowedScopes == null || allowedScopes.isEmpty()) {
|
if (allowedScopes == null || allowedScopes.isEmpty()) {
|
||||||
|
@ -222,18 +214,14 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the meta information for a client.
|
* Get the meta information for a client.
|
||||||
*
|
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @param m
|
* @param m
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('"
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
||||||
+ SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.GET,
|
public String readResourceConfiguration(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String readResourceConfiguration(@PathVariable("id") String clientId, Model m,
|
|
||||||
OAuth2Authentication auth) {
|
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
|
@ -242,9 +230,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
// possibly update the token
|
// possibly update the token
|
||||||
OAuth2AccessTokenEntity token = fetchValidRegistrationToken(auth, client);
|
OAuth2AccessTokenEntity token = fetchValidRegistrationToken(auth, client);
|
||||||
|
|
||||||
RegisteredClient registered =
|
RegisteredClient registered = new RegisteredClient(client, token.getValue(), config.getIssuer() + "resource/" + UriUtils.encodePathSegment(client.getClientId(), "UTF-8"));
|
||||||
new RegisteredClient(client, token.getValue(), config.getIssuer() + "resource/"
|
|
||||||
+ UriUtils.encodePathSegment(client.getClientId(), "UTF-8"));
|
|
||||||
|
|
||||||
// send it all out to the view
|
// send it all out to the view
|
||||||
m.addAttribute("client", registered);
|
m.addAttribute("client", registered);
|
||||||
|
@ -254,8 +240,8 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
logger.error("readResourceConfiguration failed, client ID mismatch: " + clientId + " and "
|
logger.error("readResourceConfiguration failed, client ID mismatch: "
|
||||||
+ auth.getOAuth2Request().getClientId() + " do not match.");
|
+ clientId + " and " + auth.getOAuth2Request().getClientId() + " do not match.");
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
||||||
|
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
|
@ -264,19 +250,15 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the metainformation for a given client.
|
* Update the metainformation for a given client.
|
||||||
*
|
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @param jsonString
|
* @param jsonString
|
||||||
* @param m
|
* @param m
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('"
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
||||||
+ SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.PUT,
|
public String updateProtectedResource(@PathVariable("id") String clientId, @RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String updateProtectedResource(@PathVariable("id") String clientId,
|
|
||||||
@RequestBody String jsonString, Model m, OAuth2Authentication auth) {
|
|
||||||
|
|
||||||
|
|
||||||
ClientDetailsEntity newClient = null;
|
ClientDetailsEntity newClient = null;
|
||||||
|
@ -293,12 +275,8 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
ClientDetailsEntity oldClient = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity oldClient = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
if (newClient != null && oldClient != null // we have an existing client and the new one parsed
|
if (newClient != null && oldClient != null // we have an existing client and the new one parsed
|
||||||
&& oldClient.getClientId().equals(auth.getOAuth2Request().getClientId()) // the client
|
&& oldClient.getClientId().equals(auth.getOAuth2Request().getClientId()) // the client passed in the URI matches the one in the auth
|
||||||
// passed in the
|
&& oldClient.getClientId().equals(newClient.getClientId()) // the client passed in the body matches the one in the URI
|
||||||
// URI matches the
|
|
||||||
// one in the auth
|
|
||||||
&& oldClient.getClientId().equals(newClient.getClientId()) // the client passed in the body
|
|
||||||
// matches the one in the URI
|
|
||||||
) {
|
) {
|
||||||
|
|
||||||
// a client can't ask to update its own client secret to any particular value
|
// a client can't ask to update its own client secret to any particular value
|
||||||
|
@ -359,30 +337,27 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
// possibly update the token
|
// possibly update the token
|
||||||
OAuth2AccessTokenEntity token = fetchValidRegistrationToken(auth, savedClient);
|
OAuth2AccessTokenEntity token = fetchValidRegistrationToken(auth, savedClient);
|
||||||
|
|
||||||
RegisteredClient registered =
|
RegisteredClient registered = new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "resource/" + UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
||||||
new RegisteredClient(savedClient, token.getValue(), config.getIssuer() + "resource/"
|
|
||||||
+ UriUtils.encodePathSegment(savedClient.getClientId(), "UTF-8"));
|
|
||||||
|
|
||||||
// send it all out to the view
|
// send it all out to the view
|
||||||
m.addAttribute("client", registered);
|
m.addAttribute("client", registered);
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.OK); // http 200
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.OK); // http 200
|
||||||
|
|
||||||
return ClientInformationResponseView.VIEWNAME;
|
return ClientInformationResponseView.VIEWNAME;
|
||||||
|
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.error("Couldn't save client", e);
|
logger.error("Couldn't save client", e);
|
||||||
|
|
||||||
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
m.addAttribute(JsonErrorView.ERROR, "invalid_client_metadata");
|
||||||
m.addAttribute(JsonErrorView.ERROR_MESSAGE,
|
m.addAttribute(JsonErrorView.ERROR_MESSAGE, "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
"Unable to save client due to invalid or inconsistent metadata.");
|
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
return JsonErrorView.VIEWNAME;
|
return JsonErrorView.VIEWNAME;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
logger.error("updateProtectedResource" + " failed, client ID mismatch: " + clientId + " and "
|
logger.error("updateProtectedResource" +
|
||||||
+ auth.getOAuth2Request().getClientId() + " do not match.");
|
" failed, client ID mismatch: "
|
||||||
|
+ clientId + " and " + auth.getOAuth2Request().getClientId() + " do not match.");
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
||||||
|
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
|
@ -391,18 +366,14 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete the indicated client from the system.
|
* Delete the indicated client from the system.
|
||||||
*
|
|
||||||
* @param clientId
|
* @param clientId
|
||||||
* @param m
|
* @param m
|
||||||
* @param auth
|
* @param auth
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('"
|
@PreAuthorize("hasRole('ROLE_CLIENT') and #oauth2.hasScope('" + SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
||||||
+ SystemScopeService.RESOURCE_TOKEN_SCOPE + "')")
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE,
|
public String deleteResource(@PathVariable("id") String clientId, Model m, OAuth2Authentication auth) {
|
||||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
|
||||||
public String deleteResource(@PathVariable("id") String clientId, Model m,
|
|
||||||
OAuth2Authentication auth) {
|
|
||||||
|
|
||||||
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
ClientDetailsEntity client = clientService.loadClientByClientId(clientId);
|
||||||
|
|
||||||
|
@ -415,23 +386,22 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
logger.error("readClientConfiguration failed, client ID mismatch: " + clientId + " and "
|
logger.error("readClientConfiguration failed, client ID mismatch: "
|
||||||
+ auth.getOAuth2Request().getClientId() + " do not match.");
|
+ clientId + " and " + auth.getOAuth2Request().getClientId() + " do not match.");
|
||||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
m.addAttribute(HttpCodeView.CODE, HttpStatus.FORBIDDEN); // http 403
|
||||||
|
|
||||||
return HttpCodeView.VIEWNAME;
|
return HttpCodeView.VIEWNAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientDetailsEntity validateAuth(ClientDetailsEntity newClient)
|
private ClientDetailsEntity validateAuth(ClientDetailsEntity newClient) throws ValidationException {
|
||||||
throws ValidationException {
|
|
||||||
if (newClient.getTokenEndpointAuthMethod() == null) {
|
if (newClient.getTokenEndpointAuthMethod() == null) {
|
||||||
newClient.setTokenEndpointAuthMethod(AuthMethod.SECRET_BASIC);
|
newClient.setTokenEndpointAuthMethod(AuthMethod.SECRET_BASIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_BASIC
|
if (newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_BASIC ||
|
||||||
|| newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_JWT
|
newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_JWT ||
|
||||||
|| newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_POST) {
|
newClient.getTokenEndpointAuthMethod() == AuthMethod.SECRET_POST) {
|
||||||
|
|
||||||
if (Strings.isNullOrEmpty(newClient.getClientSecret())) {
|
if (Strings.isNullOrEmpty(newClient.getClientSecret())) {
|
||||||
// no secret yet, we need to generate a secret
|
// no secret yet, we need to generate a secret
|
||||||
|
@ -439,22 +409,19 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
}
|
}
|
||||||
} else if (newClient.getTokenEndpointAuthMethod() == AuthMethod.PRIVATE_KEY) {
|
} else if (newClient.getTokenEndpointAuthMethod() == AuthMethod.PRIVATE_KEY) {
|
||||||
if (Strings.isNullOrEmpty(newClient.getJwksUri()) && newClient.getJwks() == null) {
|
if (Strings.isNullOrEmpty(newClient.getJwksUri()) && newClient.getJwks() == null) {
|
||||||
throw new ValidationException("invalid_client_metadata",
|
throw new ValidationException("invalid_client_metadata", "JWK Set URI required when using private key authentication", HttpStatus.BAD_REQUEST);
|
||||||
"JWK Set URI required when using private key authentication", HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
newClient.setClientSecret(null);
|
newClient.setClientSecret(null);
|
||||||
} else if (newClient.getTokenEndpointAuthMethod() == AuthMethod.NONE) {
|
} else if (newClient.getTokenEndpointAuthMethod() == AuthMethod.NONE) {
|
||||||
newClient.setClientSecret(null);
|
newClient.setClientSecret(null);
|
||||||
} else {
|
} else {
|
||||||
throw new ValidationException("invalid_client_metadata", "Unknown authentication method",
|
throw new ValidationException("invalid_client_metadata", "Unknown authentication method", HttpStatus.BAD_REQUEST);
|
||||||
HttpStatus.BAD_REQUEST);
|
|
||||||
}
|
}
|
||||||
return newClient;
|
return newClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OAuth2AccessTokenEntity fetchValidRegistrationToken(OAuth2Authentication auth,
|
private OAuth2AccessTokenEntity fetchValidRegistrationToken(OAuth2Authentication auth, ClientDetailsEntity client) {
|
||||||
ClientDetailsEntity client) {
|
|
||||||
|
|
||||||
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
|
OAuth2AuthenticationDetails details = (OAuth2AuthenticationDetails) auth.getDetails();
|
||||||
OAuth2AccessTokenEntity token = tokenService.readAccessToken(details.getTokenValue());
|
OAuth2AccessTokenEntity token = tokenService.readAccessToken(details.getTokenValue());
|
||||||
|
@ -463,8 +430,7 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Re-issue the token if it has been issued before [currentTime - validity]
|
// Re-issue the token if it has been issued before [currentTime - validity]
|
||||||
Date validToDate =
|
Date validToDate = new Date(System.currentTimeMillis() - config.getRegTokenLifeTime() * 1000);
|
||||||
new Date(System.currentTimeMillis() - config.getRegTokenLifeTime() * 1000);
|
|
||||||
if(token.getJwt().getJWTClaimsSet().getIssueTime().before(validToDate)) {
|
if(token.getJwt().getJWTClaimsSet().getIssueTime().before(validToDate)) {
|
||||||
logger.info("Rotating the registration access token for " + client.getClientId());
|
logger.info("Rotating the registration access token for " + client.getClientId());
|
||||||
tokenService.revokeAccessToken(token);
|
tokenService.revokeAccessToken(token);
|
||||||
|
|
|
@ -141,7 +141,8 @@ public class TestMITREidDataService_1_0 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||||
Date expirationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
|
Date expirationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||||
|
@ -156,7 +157,7 @@ public class TestMITREidDataService_1_0 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||||
|
|
||||||
Date expirationDate2 = formatter.parse("2015-01-07T18:31:50.079Z", Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse("2015-01-07T18:31:50.079+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
when(mockedClient2.getClientId()).thenReturn("mocked_client_2");
|
||||||
|
@ -181,9 +182,9 @@ public class TestMITREidDataService_1_0 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -258,7 +259,8 @@ public class TestMITREidDataService_1_0 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportAccessTokens() throws IOException, ParseException {
|
public void testImportAccessTokens() throws IOException, ParseException {
|
||||||
Date expirationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
|
Date expirationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
when(mockedClient1.getClientId()).thenReturn("mocked_client_1");
|
||||||
|
@ -275,7 +277,7 @@ public class TestMITREidDataService_1_0 {
|
||||||
token1.setScope(ImmutableSet.of("id-token"));
|
token1.setScope(ImmutableSet.of("id-token"));
|
||||||
token1.setTokenType("Bearer");
|
token1.setTokenType("Bearer");
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -307,10 +309,10 @@ public class TestMITREidDataService_1_0 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
||||||
|
|
||||||
|
@ -573,8 +575,9 @@ public class TestMITREidDataService_1_0 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportGrants() throws IOException, ParseException {
|
public void testImportGrants() throws IOException, ParseException {
|
||||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090Z", Locale.ENGLISH);
|
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
||||||
when(mockToken1.getId()).thenReturn(1L);
|
when(mockToken1.getId()).thenReturn(1L);
|
||||||
|
@ -588,9 +591,9 @@ public class TestMITREidDataService_1_0 {
|
||||||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||||
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
||||||
|
|
||||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090Z", Locale.ENGLISH);
|
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090Z", Locale.ENGLISH);
|
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090Z", Locale.ENGLISH);
|
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ApprovedSite site2 = new ApprovedSite();
|
ApprovedSite site2 = new ApprovedSite();
|
||||||
site2.setId(2L);
|
site2.setId(2L);
|
||||||
|
@ -611,11 +614,11 @@ public class TestMITREidDataService_1_0 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.GRANTS + "\": [" +
|
"\"" + MITREidDataService.GRANTS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090Z\",\"accessDate\":\"2014-09-10T23:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090+00:00\",\"accessDate\":\"2014-09-10T23:49:44.090+00:00\","
|
||||||
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
||||||
+ "\"approvedAccessTokens\":[1]}," +
|
+ "\"approvedAccessTokens\":[1]}," +
|
||||||
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090Z\",\"accessDate\":\"2014-09-11T20:49:44.090Z\","
|
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090+00:00\",\"accessDate\":\"2014-09-11T20:49:44.090+00:00\","
|
||||||
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090Z\",\"userId\":\"user2\","
|
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090+00:00\",\"userId\":\"user2\","
|
||||||
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -828,7 +831,8 @@ public class TestMITREidDataService_1_0 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -851,7 +855,7 @@ public class TestMITREidDataService_1_0 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(holder1);
|
token1.setAuthenticationHolder(holder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -890,9 +894,9 @@ public class TestMITREidDataService_1_0 {
|
||||||
" ]," +
|
" ]," +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
|
|
@ -142,7 +142,8 @@ public class TestMITREidDataService_1_1 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -158,7 +159,7 @@ public class TestMITREidDataService_1_1 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -184,9 +185,9 @@ public class TestMITREidDataService_1_1 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -261,7 +262,8 @@ public class TestMITREidDataService_1_1 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportAccessTokens() throws IOException, ParseException {
|
public void testImportAccessTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -279,7 +281,7 @@ public class TestMITREidDataService_1_1 {
|
||||||
token1.setScope(ImmutableSet.of("id-token"));
|
token1.setScope(ImmutableSet.of("id-token"));
|
||||||
token1.setTokenType("Bearer");
|
token1.setTokenType("Bearer");
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -311,10 +313,10 @@ public class TestMITREidDataService_1_1 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
||||||
|
|
||||||
|
@ -576,8 +578,9 @@ public class TestMITREidDataService_1_1 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportGrants() throws IOException, ParseException {
|
public void testImportGrants() throws IOException, ParseException {
|
||||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090Z", Locale.ENGLISH);
|
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
||||||
when(mockToken1.getId()).thenReturn(1L);
|
when(mockToken1.getId()).thenReturn(1L);
|
||||||
|
@ -591,9 +594,9 @@ public class TestMITREidDataService_1_1 {
|
||||||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||||
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
||||||
|
|
||||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090Z", Locale.ENGLISH);
|
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090Z", Locale.ENGLISH);
|
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090Z", Locale.ENGLISH);
|
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ApprovedSite site2 = new ApprovedSite();
|
ApprovedSite site2 = new ApprovedSite();
|
||||||
site2.setId(2L);
|
site2.setId(2L);
|
||||||
|
@ -614,11 +617,11 @@ public class TestMITREidDataService_1_1 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.GRANTS + "\": [" +
|
"\"" + MITREidDataService.GRANTS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090Z\",\"accessDate\":\"2014-09-10T23:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090+00:00\",\"accessDate\":\"2014-09-10T23:49:44.090+00:00\","
|
||||||
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
||||||
+ "\"approvedAccessTokens\":[1]}," +
|
+ "\"approvedAccessTokens\":[1]}," +
|
||||||
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090Z\",\"accessDate\":\"2014-09-11T20:49:44.090Z\","
|
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090+00:00\",\"accessDate\":\"2014-09-11T20:49:44.090+00:00\","
|
||||||
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090Z\",\"userId\":\"user2\","
|
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090+00:00\",\"userId\":\"user2\","
|
||||||
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -830,7 +833,8 @@ public class TestMITREidDataService_1_1 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -853,7 +857,7 @@ public class TestMITREidDataService_1_1 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(holder1);
|
token1.setAuthenticationHolder(holder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -892,9 +896,9 @@ public class TestMITREidDataService_1_1 {
|
||||||
" ]," +
|
" ]," +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
|
|
@ -144,7 +144,8 @@ public class TestMITREidDataService_1_2 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -160,7 +161,7 @@ public class TestMITREidDataService_1_2 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -186,9 +187,9 @@ public class TestMITREidDataService_1_2 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -263,7 +264,8 @@ public class TestMITREidDataService_1_2 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportAccessTokens() throws IOException, ParseException {
|
public void testImportAccessTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -281,7 +283,7 @@ public class TestMITREidDataService_1_2 {
|
||||||
token1.setScope(ImmutableSet.of("id-token"));
|
token1.setScope(ImmutableSet.of("id-token"));
|
||||||
token1.setTokenType("Bearer");
|
token1.setTokenType("Bearer");
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -313,10 +315,10 @@ public class TestMITREidDataService_1_2 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
||||||
|
|
||||||
|
@ -578,8 +580,9 @@ public class TestMITREidDataService_1_2 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportGrants() throws IOException, ParseException {
|
public void testImportGrants() throws IOException, ParseException {
|
||||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090Z", Locale.ENGLISH);
|
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
||||||
when(mockToken1.getId()).thenReturn(1L);
|
when(mockToken1.getId()).thenReturn(1L);
|
||||||
|
@ -593,9 +596,9 @@ public class TestMITREidDataService_1_2 {
|
||||||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||||
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
||||||
|
|
||||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090Z", Locale.ENGLISH);
|
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090Z", Locale.ENGLISH);
|
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090Z", Locale.ENGLISH);
|
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ApprovedSite site2 = new ApprovedSite();
|
ApprovedSite site2 = new ApprovedSite();
|
||||||
site2.setId(2L);
|
site2.setId(2L);
|
||||||
|
@ -616,11 +619,11 @@ public class TestMITREidDataService_1_2 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.GRANTS + "\": [" +
|
"\"" + MITREidDataService.GRANTS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090Z\",\"accessDate\":\"2014-09-10T23:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090+00:00\",\"accessDate\":\"2014-09-10T23:49:44.090+00:00\","
|
||||||
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
||||||
+ "\"approvedAccessTokens\":[1]}," +
|
+ "\"approvedAccessTokens\":[1]}," +
|
||||||
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090Z\",\"accessDate\":\"2014-09-11T20:49:44.090Z\","
|
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090+00:00\",\"accessDate\":\"2014-09-11T20:49:44.090+00:00\","
|
||||||
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090Z\",\"userId\":\"user2\","
|
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090+00:00\",\"userId\":\"user2\","
|
||||||
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -832,7 +835,8 @@ public class TestMITREidDataService_1_2 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -855,7 +859,7 @@ public class TestMITREidDataService_1_2 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(holder1);
|
token1.setAuthenticationHolder(holder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -894,9 +898,9 @@ public class TestMITREidDataService_1_2 {
|
||||||
" ]," +
|
" ]," +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
|
|
@ -147,7 +147,8 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportRefreshTokens() throws IOException, ParseException {
|
public void testExportRefreshTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -163,7 +164,7 @@ public class TestMITREidDataService_1_3 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -270,7 +271,8 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportRefreshTokens() throws IOException, ParseException {
|
public void testImportRefreshTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -286,7 +288,7 @@ public class TestMITREidDataService_1_3 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(mockedAuthHolder1);
|
token1.setAuthenticationHolder(mockedAuthHolder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -312,9 +314,9 @@ public class TestMITREidDataService_1_3 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -382,7 +384,8 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportAccessTokens() throws IOException, ParseException {
|
public void testExportAccessTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -400,7 +403,7 @@ public class TestMITREidDataService_1_3 {
|
||||||
token1.setScope(ImmutableSet.of("id-token"));
|
token1.setScope(ImmutableSet.of("id-token"));
|
||||||
token1.setTokenType("Bearer");
|
token1.setTokenType("Bearer");
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -520,7 +523,8 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportAccessTokens() throws IOException, ParseException {
|
public void testImportAccessTokens() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -538,7 +542,7 @@ public class TestMITREidDataService_1_3 {
|
||||||
token1.setScope(ImmutableSet.of("id-token"));
|
token1.setScope(ImmutableSet.of("id-token"));
|
||||||
token1.setTokenType("Bearer");
|
token1.setTokenType("Bearer");
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -570,10 +574,10 @@ public class TestMITREidDataService_1_3 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
"\"" + MITREidDataService.ACCESSTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":null,\"idTokenId\":null,\"scope\":[\"id-token\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3ODk5NjgsInN1YiI6IjkwMzQyLkFTREZKV0ZBIiwiYXRfaGFzaCI6InptTmt1QmNRSmNYQktNaVpFODZqY0EiLCJhdWQiOlsiY2xpZW50Il0sImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDgwXC9vcGVuaWQtY29ubmVjdC1zZXJ2ZXItd2ViYXBwXC8iLCJpYXQiOjE0MTI3ODkzNjh9.xkEJ9IMXpH7qybWXomfq9WOOlpGYnrvGPgey9UQ4GLzbQx7JC0XgJK83PmrmBZosvFPCmota7FzI_BtwoZLgAZfFiH6w3WIlxuogoH-TxmYbxEpTHoTsszZppkq9mNgOlArV4jrR9y3TPo4MovsH71dDhS_ck-CvAlJunHlqhs0\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
+ "\"refreshTokenId\":1,\"idTokenId\":1,\"scope\":[\"openid\",\"offline_access\",\"email\",\"profile\"],\"type\":\"Bearer\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE0MTI3OTI5NjgsImF1ZCI6WyJjbGllbnQiXSwiaXNzIjoiaHR0cDpcL1wvbG9jYWxob3N0OjgwODBcL29wZW5pZC1jb25uZWN0LXNlcnZlci13ZWJhcHBcLyIsImp0aSI6IjBmZGE5ZmRiLTYyYzItNGIzZS05OTdiLWU0M2VhMDUwMzNiOSIsImlhdCI6MTQxMjc4OTM2OH0.xgaVpRLYE5MzbgXfE0tZt823tjAm6Oh3_kdR1P2I9jRLR6gnTlBQFlYi3Y_0pWNnZSerbAE8Tn6SJHZ9k-curVG0-ByKichV7CNvgsE5X_2wpEaUzejvKf8eZ-BammRY-ie6yxSkAarcUGMvGGOLbkFcz5CtrBpZhfd75J49BIQ\"}" +
|
||||||
|
|
||||||
|
@ -1128,8 +1132,9 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportGrants() throws IOException, ParseException {
|
public void testExportGrants() throws IOException, ParseException {
|
||||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090Z", Locale.ENGLISH);
|
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
||||||
when(mockToken1.getId()).thenReturn(1L);
|
when(mockToken1.getId()).thenReturn(1L);
|
||||||
|
@ -1143,9 +1148,9 @@ public class TestMITREidDataService_1_3 {
|
||||||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||||
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
||||||
|
|
||||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090Z", Locale.ENGLISH);
|
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090Z", Locale.ENGLISH);
|
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090Z", Locale.ENGLISH);
|
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ApprovedSite site2 = new ApprovedSite();
|
ApprovedSite site2 = new ApprovedSite();
|
||||||
site2.setId(2L);
|
site2.setId(2L);
|
||||||
|
@ -1243,8 +1248,9 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testImportGrants() throws IOException, ParseException {
|
public void testImportGrants() throws IOException, ParseException {
|
||||||
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090Z", Locale.ENGLISH);
|
|
||||||
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090Z", Locale.ENGLISH);
|
Date creationDate1 = formatter.parse("2014-09-10T22:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
Date accessDate1 = formatter.parse("2014-09-10T23:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
OAuth2AccessTokenEntity mockToken1 = mock(OAuth2AccessTokenEntity.class);
|
||||||
when(mockToken1.getId()).thenReturn(1L);
|
when(mockToken1.getId()).thenReturn(1L);
|
||||||
|
@ -1258,9 +1264,9 @@ public class TestMITREidDataService_1_3 {
|
||||||
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
site1.setAllowedScopes(ImmutableSet.of("openid", "phone"));
|
||||||
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
when(mockToken1.getApprovedSite()).thenReturn(site1);
|
||||||
|
|
||||||
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090Z", Locale.ENGLISH);
|
Date creationDate2 = formatter.parse("2014-09-11T18:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090Z", Locale.ENGLISH);
|
Date accessDate2 = formatter.parse("2014-09-11T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090Z", Locale.ENGLISH);
|
Date timeoutDate2 = formatter.parse("2014-10-01T20:49:44.090+00:00", Locale.ENGLISH);
|
||||||
|
|
||||||
ApprovedSite site2 = new ApprovedSite();
|
ApprovedSite site2 = new ApprovedSite();
|
||||||
site2.setId(2L);
|
site2.setId(2L);
|
||||||
|
@ -1281,11 +1287,11 @@ public class TestMITREidDataService_1_3 {
|
||||||
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
"\"" + MITREidDataService.AUTHENTICATIONHOLDERS + "\": [], " +
|
||||||
"\"" + MITREidDataService.GRANTS + "\": [" +
|
"\"" + MITREidDataService.GRANTS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090Z\",\"accessDate\":\"2014-09-10T23:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"foo\",\"creationDate\":\"2014-09-10T22:49:44.090+00:00\",\"accessDate\":\"2014-09-10T23:49:44.090+00:00\","
|
||||||
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
+ "\"userId\":\"user1\",\"whitelistedSiteId\":null,\"allowedScopes\":[\"openid\",\"phone\"], \"whitelistedSiteId\":1,"
|
||||||
+ "\"approvedAccessTokens\":[1]}," +
|
+ "\"approvedAccessTokens\":[1]}," +
|
||||||
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090Z\",\"accessDate\":\"2014-09-11T20:49:44.090Z\","
|
"{\"id\":2,\"clientId\":\"bar\",\"creationDate\":\"2014-09-11T18:49:44.090+00:00\",\"accessDate\":\"2014-09-11T20:49:44.090+00:00\","
|
||||||
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090Z\",\"userId\":\"user2\","
|
+ "\"timeoutDate\":\"2014-10-01T20:49:44.090+00:00\",\"userId\":\"user2\","
|
||||||
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
+ "\"allowedScopes\":[\"openid\",\"offline_access\",\"email\",\"profile\"]}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
@ -1714,7 +1720,8 @@ public class TestMITREidDataService_1_3 {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
public void testFixRefreshTokenAuthHolderReferencesOnImport() throws IOException, ParseException {
|
||||||
String expiration1 = "2014-09-10T22:49:44.090Z";
|
|
||||||
|
String expiration1 = "2014-09-10T22:49:44.090+00:00";
|
||||||
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
Date expirationDate1 = formatter.parse(expiration1, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient1 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -1737,7 +1744,7 @@ public class TestMITREidDataService_1_3 {
|
||||||
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
token1.setJwt(JWTParser.parse("eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ."));
|
||||||
token1.setAuthenticationHolder(holder1);
|
token1.setAuthenticationHolder(holder1);
|
||||||
|
|
||||||
String expiration2 = "2015-01-07T18:31:50.079Z";
|
String expiration2 = "2015-01-07T18:31:50.079+00:00";
|
||||||
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
Date expirationDate2 = formatter.parse(expiration2, Locale.ENGLISH);
|
||||||
|
|
||||||
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
ClientDetailsEntity mockedClient2 = mock(ClientDetailsEntity.class);
|
||||||
|
@ -1776,9 +1783,9 @@ public class TestMITREidDataService_1_3 {
|
||||||
" ]," +
|
" ]," +
|
||||||
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
"\"" + MITREidDataService.REFRESHTOKENS + "\": [" +
|
||||||
|
|
||||||
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090Z\","
|
"{\"id\":1,\"clientId\":\"mocked_client_1\",\"expiration\":\"2014-09-10T22:49:44.090+00:00\","
|
||||||
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
+ "\"authenticationHolderId\":1,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJmOTg4OWQyOS0xMTk1LTQ4ODEtODgwZC1lZjVlYzAwY2Y4NDIifQ.\"}," +
|
||||||
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079Z\","
|
"{\"id\":2,\"clientId\":\"mocked_client_2\",\"expiration\":\"2015-01-07T18:31:50.079+00:00\","
|
||||||
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
+ "\"authenticationHolderId\":2,\"value\":\"eyJhbGciOiJub25lIn0.eyJqdGkiOiJlYmEyYjc3My0xNjAzLTRmNDAtOWQ3MS1hMGIxZDg1OWE2MDAifQ.\"}" +
|
||||||
|
|
||||||
" ]" +
|
" ]" +
|
||||||
|
|
45
pom.xml
45
pom.xml
|
@ -67,7 +67,7 @@
|
||||||
</mailingLists>
|
</mailingLists>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java-version>1.8</java-version>
|
<java-version>11</java-version>
|
||||||
<org.slf4j-version>1.7.25</org.slf4j-version>
|
<org.slf4j-version>1.7.25</org.slf4j-version>
|
||||||
</properties>
|
</properties>
|
||||||
<description>A reference implementation of OpenID Connect (http://openid.net/connect/), OAuth 2.0, and UMA built on top of Java, Spring, and Spring Security. The project contains a fully functioning server, client, and utility library.</description>
|
<description>A reference implementation of OpenID Connect (http://openid.net/connect/), OAuth 2.0, and UMA built on top of Java, Spring, and Spring Security. The project contains a fully functioning server, client, and utility library.</description>
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.7.9</version>
|
<version>0.8.7</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -175,7 +175,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>ro.isdc.wro4j</groupId>
|
<groupId>ro.isdc.wro4j</groupId>
|
||||||
<artifactId>wro4j-maven-plugin</artifactId>
|
<artifactId>wro4j-maven-plugin</artifactId>
|
||||||
<version>1.8.0</version>
|
<version>1.10.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>compile</phase>
|
<phase>compile</phase>
|
||||||
|
@ -188,7 +188,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ro.isdc.wro4j</groupId>
|
<groupId>ro.isdc.wro4j</groupId>
|
||||||
<artifactId>wro4j-extensions</artifactId>
|
<artifactId>wro4j-extensions</artifactId>
|
||||||
<version>1.8.0</version>
|
<version>1.10.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
@ -460,12 +460,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.persistence</groupId>
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
<artifactId>org.eclipse.persistence.jpa</artifactId>
|
<artifactId>org.eclipse.persistence.jpa</artifactId>
|
||||||
<version>2.5.1</version>
|
<version>2.7.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.persistence</groupId>
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
<artifactId>javax.persistence</artifactId>
|
<artifactId>javax.persistence</artifactId>
|
||||||
<version>2.1.1</version>
|
<version>2.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.zaxxer</groupId>
|
<groupId>com.zaxxer</groupId>
|
||||||
|
@ -585,7 +585,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>21.0</version>
|
<version>27.0-jre</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.code.gson</groupId>
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
@ -616,7 +616,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.persistence</groupId>
|
<groupId>org.eclipse.persistence</groupId>
|
||||||
<artifactId>org.eclipse.persistence.core</artifactId>
|
<artifactId>org.eclipse.persistence.core</artifactId>
|
||||||
<version>2.5.1</version>
|
<version>2.7.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
@ -626,7 +626,34 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>ro.isdc.wro4j</groupId>
|
<groupId>ro.isdc.wro4j</groupId>
|
||||||
<artifactId>wro4j-extensions</artifactId>
|
<artifactId>wro4j-extensions</artifactId>
|
||||||
<version>1.8.0</version>
|
<version>1.10.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- java11 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.annotation</groupId>
|
||||||
|
<artifactId>javax.annotation-api</artifactId>
|
||||||
|
<version>1.3.2</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.xml.bind</groupId>
|
||||||
|
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.activation</groupId>
|
||||||
|
<artifactId>activation</artifactId>
|
||||||
|
<version>1.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.glassfish.jaxb</groupId>
|
||||||
|
<artifactId>jaxb-runtime</artifactId>
|
||||||
|
<version>2.3.0-b170127.1453</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mitre</groupId>
|
<groupId>org.mitre</groupId>
|
||||||
<artifactId>openid-connect-parent</artifactId>
|
<artifactId>openid-connect-parent</artifactId>
|
||||||
<version>1.3.3-SNAPSHOT</version>
|
<version>1.3.5-SNAPSHOT</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>uma-server-webapp</artifactId>
|
<artifactId>uma-server-webapp</artifactId>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.mitre</groupId>
|
<groupId>org.mitre</groupId>
|
||||||
<artifactId>openid-connect-parent</artifactId>
|
<artifactId>openid-connect-parent</artifactId>
|
||||||
<version>1.3.3-SNAPSHOT</version>
|
<version>1.3.5-SNAPSHOT</version>
|
||||||
<relativePath>..</relativePath>
|
<relativePath>..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>uma-server</artifactId>
|
<artifactId>uma-server</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue