新增OAuth2 server

This commit is contained in:
zhouhao
2017-04-07 09:28:11 +08:00
parent 02e69163a9
commit 86a22c5a87
20 changed files with 70 additions and 76 deletions

View File

@@ -21,13 +21,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<artifactId>hsweb-system-oauth2-server</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-controller</artifactId>
<artifactId>hsweb-system-oauth2-server-controller</artifactId>
<dependencies>
<dependency>
@@ -37,18 +37,18 @@
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-model</artifactId>
<artifactId>hsweb-system-oauth2-server-model</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-api</artifactId>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.oltu.oauth2</groupId>
<artifactId>org.apache.oltu.oauth2.authzserver</artifactId>
<version>1.0.2</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.oltu.oauth2</groupId>-->
<!--<artifactId>org.apache.oltu.oauth2.authzserver</artifactId>-->
<!--<version>1.0.2</version>-->
<!--</dependency>-->
</dependencies>
</project>

View File

@@ -25,10 +25,10 @@ import org.hswebframework.web.AuthorizeException;
import org.hswebframework.web.authorization.Authentication;
import org.hswebframework.web.authorization.annotation.Authorize;
import org.hswebframework.web.authorization.oauth2.api.OAuth2ServerService;
import org.hswebframework.web.authorization.oauth2.model.AccessTokenModel;
import org.hswebframework.web.authorization.oauth2.model.AuthorizationCodeModel;
import org.hswebframework.web.authorization.oauth2.model.ImplicitAccessTokenModel;
import org.hswebframework.web.entity.authorization.oauth2.OAuth2AccessEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2AccessEntity;
import org.hswebframework.web.oauth2.model.AccessTokenModel;
import org.hswebframework.web.oauth2.model.AuthorizationCodeModel;
import org.hswebframework.web.oauth2.model.ImplicitAccessTokenModel;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@@ -75,7 +75,6 @@ public class OAuth2AuthorizationController {
// OAuth2ClientEntity clientEntity = oAuth2ServerService.getClient(client_id);
// TODO: 17-3-6 validate redirect_uri
OAuth2AccessEntity accessEntity = oAuth2ServerService.requestTokenByImplicit(client_id, scope);
ImplicitAccessTokenModel model = new ImplicitAccessTokenModel();
model.setState(state);

View File

@@ -21,13 +21,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server-dao</artifactId>
<artifactId>hsweb-system-oauth2-server-dao</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-dao-api</artifactId>
<artifactId>hsweb-system-oauth2-server-dao-api</artifactId>
<dependencies>
<dependency>
@@ -37,7 +37,7 @@
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-entity</artifactId>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@@ -16,16 +16,14 @@
*
*/
package org.hswebframework.web.dao.authorization.oauth2;
package org.hswebframework.web.dao.oauth2;
import org.hswebframework.web.entity.authorization.oauth2.AuthorizationCodeEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.AuthorizationCodeEntity;
import org.hswebframework.web.dao.InsertDao;
import org.hswebframework.web.dao.dynamic.DeleteByEntityDao;
import org.hswebframework.web.dao.dynamic.QueryByEntityDao;
/**
* TODO 完成注释
*
* @author zhouhao
*/
public interface AuthorizationCodeDao extends

View File

@@ -16,9 +16,9 @@
*
*/
package org.hswebframework.web.dao.authorization.oauth2;
package org.hswebframework.web.dao.oauth2;
import org.hswebframework.web.entity.authorization.oauth2.OAuth2AccessEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2AccessEntity;
import org.hswebframework.web.dao.InsertDao;
import org.hswebframework.web.dao.dynamic.DeleteByEntityDao;
import org.hswebframework.web.dao.dynamic.QueryByEntityDao;

View File

@@ -16,13 +16,13 @@
*
*/
package org.hswebframework.web.dao.authorization.oauth2;
package org.hswebframework.web.dao.oauth2;
import org.hswebframework.web.entity.authorization.oauth2.OAuth2ClientEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2ClientEntity;
import org.hswebframework.web.dao.CrudDao;
/**
* TODO 完成注释
*
* @author zhouhao
*/

View File

@@ -21,18 +21,18 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server-dao</artifactId>
<artifactId>hsweb-system-oauth2-server-dao</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-dao-mybatis</artifactId>
<artifactId>hsweb-system-oauth2-server-dao-mybatis</artifactId>
<dependencies>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-dao-api</artifactId>
<artifactId>hsweb-system-oauth2-server-dao-api</artifactId>
<version>${project.version}</version>
</dependency>

View File

@@ -21,8 +21,8 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.hswebframework.web.dao.authorization.oauth2.OAuth2AccessDao">
<resultMap id="OAuth2AccessResultMap" type="org.hswebframework.web.entity.authorization.oauth2.SimpleOAuth2AccessEntity">
<mapper namespace="org.hswebframework.web.dao.oauth2.OAuth2AccessDao">
<resultMap id="OAuth2AccessResultMap" type="org.hswebframework.web.authorization.oauth2.api.entity.SimpleOAuth2AccessEntity">
<result property="clientId" column="client_id" javaType="String" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" javaType="String" jdbcType="VARCHAR"/>
<result property="accessToken" column="access_token" javaType="String" jdbcType="VARCHAR"/>
@@ -39,7 +39,7 @@
<bind name="tableName" value="'s_oauth2_access'"/>
</sql>
<insert id="insert" parameterType="org.hswebframework.web.entity.authorization.oauth2.SimpleOAuth2ClientEntity">
<insert id="insert" parameterType="org.hswebframework.web.authorization.oauth2.api.entity.SimpleOAuth2ClientEntity">
<include refid="config"/>
<include refid="BasicMapper.buildInsertSql"/>
</insert>

View File

@@ -21,8 +21,8 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.hswebframework.web.dao.authorization.oauth2.OAuth2ClientDao">
<resultMap id="OAuth2ClientResultMap" type="org.hswebframework.web.entity.authorization.oauth2.SimpleOAuth2ClientEntity">
<mapper namespace="org.hswebframework.web.dao.oauth2.OAuth2ClientDao">
<resultMap id="OAuth2ClientResultMap" type="org.hswebframework.web.authorization.oauth2.api.entity.SimpleOAuth2ClientEntity">
<id property="id" column="u_id" javaType="String" jdbcType="VARCHAR"/>
<result property="secret" column="secret" javaType="String" jdbcType="VARCHAR"/>
<result property="name" column="name" javaType="String" jdbcType="VARCHAR"/>
@@ -41,7 +41,7 @@
<bind name="tableName" value="'s_oauth2_client'"/>
</sql>
<insert id="insert" parameterType="org.hswebframework.web.entity.authorization.oauth2.SimpleOAuth2ClientEntity">
<insert id="insert" parameterType="org.hswebframework.web.authorization.oauth2.api.entity.SimpleOAuth2ClientEntity">
<include refid="config"/>
<include refid="BasicMapper.buildInsertSql"/>
</insert>

View File

@@ -21,8 +21,8 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://www.mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.hswebframework.web.dao.authorization.oauth2.AuthorizationCodeDao">
<resultMap id="AuthorizationCodeResultMap" type="org.hswebframework.web.entity.authorization.oauth2.SimpleAuthorizationCodeEntity">
<mapper namespace="org.hswebframework.web.dao.oauth2.AuthorizationCodeDao">
<resultMap id="AuthorizationCodeResultMap" type="org.hswebframework.web.authorization.oauth2.api.entity.SimpleAuthorizationCodeEntity">
<result property="clientId" column="client_id" javaType="String" jdbcType="VARCHAR"/>
<result property="userId" column="user_id" javaType="String" jdbcType="VARCHAR"/>
<result property="code" column="code" javaType="String" jdbcType="VARCHAR"/>
@@ -36,7 +36,7 @@
<bind name="tableName" value="'s_oauth2_auth_code'"/>
</sql>
<insert id="insert" parameterType="org.hswebframework.web.entity.authorization.oauth2.SimpleOAuth2ClientEntity">
<insert id="insert" parameterType="org.hswebframework.web.authorization.oauth2.api.entity.SimpleOAuth2ClientEntity">
<include refid="config"/>
<include refid="BasicMapper.buildInsertSql"/>
</insert>

View File

@@ -21,17 +21,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<artifactId>hsweb-system-oauth2-server</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-dao</artifactId>
<artifactId>hsweb-system-oauth2-server-dao</artifactId>
<packaging>pom</packaging>
<modules>
<module>hsweb-authorization-oauth2-server-dao-api</module>
<module>hsweb-authorization-oauth2-server-dao-mybatis</module>
<module>hsweb-system-oauth2-server-dao-api</module>
<module>hsweb-system-oauth2-server-dao-mybatis</module>
</modules>

View File

@@ -21,13 +21,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<artifactId>hsweb-system-oauth2-server</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-model</artifactId>
<artifactId>hsweb-system-oauth2-server-model</artifactId>
<dependencies>
<dependency>

View File

@@ -21,21 +21,16 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<artifactId>hsweb-system-oauth2-server</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-simple</artifactId>
<artifactId>hsweb-system-oauth2-server-simple</artifactId>
<dependencies>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-commons-service-simple</artifactId>
@@ -48,7 +43,7 @@
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-dao-api</artifactId>
<artifactId>hsweb-system-oauth2-server-dao-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

View File

@@ -16,17 +16,17 @@
*
*/
package org.hswebframework.web.authorization.oauth2.simple;
package org.hswebframework.web.oauth2.service;
import org.hswebframework.web.AuthorizeForbiddenException;
import org.hswebframework.web.NotFoundException;
import org.hswebframework.web.authorization.oauth2.api.OAuth2ServerService;
import org.hswebframework.web.dao.authorization.oauth2.AuthorizationCodeDao;
import org.hswebframework.web.dao.authorization.oauth2.OAuth2AccessDao;
import org.hswebframework.web.dao.authorization.oauth2.OAuth2ClientDao;
import org.hswebframework.web.entity.authorization.oauth2.AuthorizationCodeEntity;
import org.hswebframework.web.entity.authorization.oauth2.OAuth2AccessEntity;
import org.hswebframework.web.entity.authorization.oauth2.OAuth2ClientEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.AuthorizationCodeEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2AccessEntity;
import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2ClientEntity;
import org.hswebframework.web.dao.oauth2.AuthorizationCodeDao;
import org.hswebframework.web.dao.oauth2.OAuth2AccessDao;
import org.hswebframework.web.dao.oauth2.OAuth2ClientDao;
import org.hswebframework.web.commons.entity.GenericEntity;
import org.hswebframework.web.commons.entity.factory.EntityFactory;
import org.hswebframework.web.entity.authorization.UserEntity;

View File

@@ -21,13 +21,13 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<artifactId>hsweb-system-oauth2-server</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-starter</artifactId>
<artifactId>hsweb-system-oauth2-server-starter</artifactId>
<build>
<resources>
@@ -40,17 +40,17 @@
<dependencies>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-simple</artifactId>
<artifactId>hsweb-system-oauth2-server-simple</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-dao-mybatis</artifactId>
<artifactId>hsweb-system-oauth2-server-dao-mybatis</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-controller</artifactId>
<artifactId>hsweb-system-oauth2-server-controller</artifactId>
<version>${project.version}</version>
</dependency>

View File

@@ -21,19 +21,21 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>hsweb-authorization-oauth2-server</artifactId>
<artifactId>hsweb-system</artifactId>
<groupId>org.hswebframework.web</groupId>
<version>3.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hsweb-authorization-oauth2-server-api</artifactId>
<modules>
<module>hsweb-system-oauth2-server-controller</module>
<module>hsweb-system-oauth2-server-simple</module>
<module>hsweb-system-oauth2-server-starter</module>
<module>hsweb-system-oauth2-server-dao</module>
<module>hsweb-system-oauth2-server-model</module>
</modules>
<packaging>pom</packaging>
<artifactId>hsweb-system-oauth2-server</artifactId>
<dependencies>
<dependency>
<groupId>org.hswebframework.web</groupId>
<artifactId>hsweb-authorization-oauth2-server-entity</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>