From 2f87b3aaadaf0a6fbcd03e659ee8a30206a98d99 Mon Sep 17 00:00:00 2001 From: zhouhao Date: Fri, 7 Apr 2017 09:28:29 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4OAuth2=20=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hsweb-authorization-oauth2-client/pom.xml | 7 + .../oauth2/client/OAuth2RequestService.java | 64 ++++++++ .../oauth2/client/OAuth2ServerConfig.java | 42 ++++++ .../oauth2/client/OAuth2SessionBuilder.java | 39 +++++ .../listener/OAuth2CodeAuthBeforeEvent.java | 54 +++++++ .../oauth2/client/listener/OAuth2Event.java | 27 ++++ .../client/listener/OAuth2Listener.java | 28 ++++ .../oauth2/client/request/OAuth2Request.java | 138 ++++++++++++++++++ .../oauth2/client/request/OAuth2Session.java | 36 +++++ .../client/response/OAuth2Response.java | 39 +++++ .../pom.xml | 45 ------ .../hsweb-authorization-oauth2-server/pom.xml | 18 +-- .../oauth2/api/OAuth2ServerService.java | 5 +- .../api/entity}/AuthorizationCodeEntity.java | 2 +- .../api/entity}/OAuth2AccessEntity.java | 2 +- .../api/entity}/OAuth2ClientEntity.java | 5 +- .../SimpleAuthorizationCodeEntity.java | 2 +- .../api/entity}/SimpleOAuth2AccessEntity.java | 2 +- .../api/entity}/SimpleOAuth2ClientEntity.java | 2 +- 19 files changed, 491 insertions(+), 66 deletions(-) create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2RequestService.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2ServerConfig.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2SessionBuilder.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2CodeAuthBeforeEvent.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Event.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Listener.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Request.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Session.java create mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/response/OAuth2Response.java delete mode 100644 hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/pom.xml rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-api => }/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java (90%) rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2 => src/main/java/org/hswebframework/web/authorization/oauth2/api/entity}/AuthorizationCodeEntity.java (94%) rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2 => src/main/java/org/hswebframework/web/authorization/oauth2/api/entity}/OAuth2AccessEntity.java (95%) rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2 => src/main/java/org/hswebframework/web/authorization/oauth2/api/entity}/OAuth2ClientEntity.java (92%) rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2 => src/main/java/org/hswebframework/web/authorization/oauth2/api/entity}/SimpleAuthorizationCodeEntity.java (96%) rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2 => src/main/java/org/hswebframework/web/authorization/oauth2/api/entity}/SimpleOAuth2AccessEntity.java (97%) rename hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/{hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2 => src/main/java/org/hswebframework/web/authorization/oauth2/api/entity}/SimpleOAuth2ClientEntity.java (97%) diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml index ce1902b68..2b18cf97a 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/pom.xml @@ -30,4 +30,11 @@ hsweb-authorization-oauth2-client + + + org.hswebframework.web + hsweb-authorization-api + ${project.version} + + \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2RequestService.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2RequestService.java new file mode 100644 index 000000000..9afe99eaa --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2RequestService.java @@ -0,0 +1,64 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client; + +import org.hswebframework.web.authorization.Authentication; +import org.hswebframework.web.authorization.oauth2.client.listener.OAuth2Event; +import org.hswebframework.web.authorization.oauth2.client.listener.OAuth2Listener; +import org.hswebframework.web.authorization.oauth2.client.request.OAuth2Session; +import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response; + +import java.util.List; +import java.util.function.Function; + +/** + * @author zhouhao + */ +public interface OAuth2RequestService { + OAuth2SessionBuilder create(String serverId); + + void registerListener(String serverId, OAuth2Listener listener); + + void doEvent(String serverId, OAuth2Event event); + + void doEvent(String serverId, OAuth2Event event, Class eventType); + + + static void main(String[] args) { + OAuth2RequestService requestService = null; + Function authExchanger = null; + String authorizationCode = ""; + + OAuth2Session session = requestService + .create("hsweb-user-center") + .byAuthorizationCode(authorizationCode); + + Authentication authentication = session + .request("oauth2/user-auth-info") + .get() + .as(Authentication.class); + + session.request("menu") + .param("paging", "0") + .get().as(List.class); + + authentication.getUser().getId(); + + } +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2ServerConfig.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2ServerConfig.java new file mode 100644 index 000000000..56f506f5a --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2ServerConfig.java @@ -0,0 +1,42 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client; + +/** + * TODO 完成注释 + * + * @author zhouhao + */ +public interface OAuth2ServerConfig { + String name = "name"; + + String describe = "describe"; + + String apiBaseUrl = "apiBaseUrl"; + + String authUrl = "authUrl"; + + String accessTokenUrl = "accessTokenUrl"; + + String clientId = "clientId"; + + String clientSecret = "clientSecret"; + + +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2SessionBuilder.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2SessionBuilder.java new file mode 100644 index 000000000..9cb3f219c --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/OAuth2SessionBuilder.java @@ -0,0 +1,39 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client; + +import org.hswebframework.web.authorization.oauth2.client.request.OAuth2Session; + +/** + * @author zhouhao + */ +public interface OAuth2SessionBuilder { + OAuth2Session byAuthorizationCode(String code); + + OAuth2Session byClientCredentials(); + + OAuth2Session byPassword(String username, String password); + + OAuth2Session byImplicit(); + + OAuth2Session refreshToken(String refreshToken); + + OAuth2Session byAccessToken(String accessToken); + +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2CodeAuthBeforeEvent.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2CodeAuthBeforeEvent.java new file mode 100644 index 000000000..0dc45736d --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2CodeAuthBeforeEvent.java @@ -0,0 +1,54 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client.listener; + + +import java.util.Optional; +import java.util.function.Function; + +/** + * TODO 完成注释 + * + * @author zhouhao + */ +public class OAuth2CodeAuthBeforeEvent implements OAuth2Event { + private String code; + private String state; + private Function parameterGetter; + + public OAuth2CodeAuthBeforeEvent(String code, String state, Function parameterGetter) { + this.code = code; + this.state = state; + this.parameterGetter = parameterGetter; + } + + public String getCode() { + return code; + } + + public String getState() { + return state; + } + + @SuppressWarnings("unchecked") + public Optional getParameter(String name) { + return Optional.ofNullable((T) parameterGetter.apply(name)); + } + +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Event.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Event.java new file mode 100644 index 000000000..47297e954 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Event.java @@ -0,0 +1,27 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client.listener; + +/** + * TODO 完成注释 + * + * @author zhouhao + */ +public interface OAuth2Event { +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Listener.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Listener.java new file mode 100644 index 000000000..1b04cbb6c --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/listener/OAuth2Listener.java @@ -0,0 +1,28 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client.listener; + +/** + * TODO 完成注释 + * + * @author zhouhao + */ +public interface OAuth2Listener { + void on(T event); +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Request.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Request.java new file mode 100644 index 000000000..4dcf8dd21 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Request.java @@ -0,0 +1,138 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client.request; + +import org.hswebframework.web.authorization.oauth2.client.response.OAuth2Response; + +import java.util.function.Consumer; + +/** + * OAuth2请求接口,用于发起OAuth2请求 + * + * @author zhouhao + */ +public interface OAuth2Request { + /** + * 设置路径参数,如url为:/user/{userId} .设置pathParam("userId","admin"),将自动解析url为 /user/admin + * + * @param name 参数名称 + * @param value 参数值 + * @return request自身 + */ + OAuth2Request pathParam(String name, Object value); + + /** + * 设置请求参数,相当于/url?name=value + * + * @param name 参数名称 + * @param value 参数值 + * @return request自身 + */ + OAuth2Request param(String name, Object value); + + /** + * 设置请求体,将内容根据contentType(默认application/json)序列化为对应的请求数据 + * + * @param value 请求内容 + * @return request自身 + */ + OAuth2Request requestBody(Object value); + + /** + * 设置请求头 + * + * @param name 名称 + * @param value 值 + * @return request自身 + */ + OAuth2Request header(String name, String value); + + /** + * 设置cookie + * + * @param name 名称 + * @param value 值 + * @return request自身 + */ + OAuth2Request cookie(String name, String value); + + /** + * 设置请求的contentType + * + * @param contentType + * @return request自身 + * @see "application/json" + */ + OAuth2Request contentType(String contentType); + + /** + * 设置接受响应的格式,相当与请求头:Accept + * + * @param accept + * @return request自身 + * @see "application/json" + */ + OAuth2Request accept(String accept); + + /** + * 设置请求超时时间,超时后回调 timeoutConsumer + * + * @param millisecond 超时时间(毫秒),小于0则不设置超时 + * @param timeoutCallBack 超时后的处理回调 + * @return request自身 + * @see Consumer + */ + OAuth2Request timeout(long millisecond, Consumer timeoutCallBack); + + /** + * 以GET方式请求,并返回请求结果 + * + * @return 请求结果 + */ + OAuth2Response get(); + + /** + * 以PUT方式请求,并返回请求结果 + * + * @return 请求结果 + */ + OAuth2Response put(); + + /** + * 以POST方式请求,并返回请求结果 + * + * @return 请求结果 + */ + OAuth2Response post(); + + /** + * 以DELETE方式请求,并返回请求结果 + * + * @return 请求结果 + */ + OAuth2Response delete(); + + /** + * 以PATCH方式请求,并返回请求结果 + * + * @return 请求结果 + */ + OAuth2Response patch(); + +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Session.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Session.java new file mode 100644 index 000000000..437f469ec --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/request/OAuth2Session.java @@ -0,0 +1,36 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client.request; + +import java.io.Serializable; + +/** + * @author zhouhao + */ +public interface OAuth2Session extends Serializable { + OAuth2Session connect(); + + OAuth2Request request(String uriOrUrl); + + OAuth2Session param(String name, Object value); + + void close(); + + boolean isClosed(); +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/response/OAuth2Response.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/response/OAuth2Response.java new file mode 100644 index 000000000..84104fb02 --- /dev/null +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/response/OAuth2Response.java @@ -0,0 +1,39 @@ +/* + * Copyright 2016 http://www.hswebframework.org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + */ + +package org.hswebframework.web.authorization.oauth2.client.response; + +import java.util.List; +import java.util.function.Function; + +/** + * @author zhouhao + */ +public interface OAuth2Response { + String asString(); + + byte[] asBytes(); + + T as(Function exchangeFunction); + + T as(Class type); + + List asList(Class type); + + int status(); +} diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/pom.xml deleted file mode 100644 index f798be18c..000000000 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - hsweb-authorization-oauth2-server - org.hswebframework.web - 3.0-SNAPSHOT - - 4.0.0 - - hsweb-authorization-oauth2-server-entity - - - - - org.hswebframework.web - hsweb-commons-entity - ${project.version} - - - org.hswebframework.web - hsweb-authorization-api - ${project.version} - - - \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/pom.xml b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/pom.xml index 45c801fa4..779f80d80 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/pom.xml +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/pom.xml @@ -28,15 +28,11 @@ 4.0.0 hsweb-authorization-oauth2-server - pom - - hsweb-authorization-oauth2-server-entity - hsweb-authorization-oauth2-server-dao - hsweb-authorization-oauth2-server-api - hsweb-authorization-oauth2-server-simple - hsweb-authorization-oauth2-server-controller - hsweb-authorization-oauth2-server-model - hsweb-authorization-oauth2-server-starter - - + + + org.hswebframework.web + hsweb-commons-entity + ${project.version} + + \ No newline at end of file diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-api/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java similarity index 90% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-api/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java index 168e83f78..b99a3afd9 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-api/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/OAuth2ServerService.java @@ -18,8 +18,9 @@ package org.hswebframework.web.authorization.oauth2.api; -import org.hswebframework.web.entity.authorization.oauth2.OAuth2AccessEntity; -import org.hswebframework.web.entity.authorization.oauth2.OAuth2ClientEntity; + +import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2AccessEntity; +import org.hswebframework.web.authorization.oauth2.api.entity.OAuth2ClientEntity; /** * @author zhouhao diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/AuthorizationCodeEntity.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/AuthorizationCodeEntity.java similarity index 94% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/AuthorizationCodeEntity.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/AuthorizationCodeEntity.java index 0206cee8e..24e819263 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/AuthorizationCodeEntity.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/AuthorizationCodeEntity.java @@ -16,7 +16,7 @@ * */ -package org.hswebframework.web.entity.authorization.oauth2; +package org.hswebframework.web.authorization.oauth2.api.entity; import org.hswebframework.web.commons.entity.Entity; diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/OAuth2AccessEntity.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/OAuth2AccessEntity.java similarity index 95% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/OAuth2AccessEntity.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/OAuth2AccessEntity.java index d3a8d9275..20133b03e 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/OAuth2AccessEntity.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/OAuth2AccessEntity.java @@ -16,7 +16,7 @@ * */ -package org.hswebframework.web.entity.authorization.oauth2; +package org.hswebframework.web.authorization.oauth2.api.entity; import org.hswebframework.web.commons.entity.Entity; diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/OAuth2ClientEntity.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/OAuth2ClientEntity.java similarity index 92% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/OAuth2ClientEntity.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/OAuth2ClientEntity.java index 44046cf01..a0a3755b8 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/OAuth2ClientEntity.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/OAuth2ClientEntity.java @@ -16,9 +16,8 @@ * */ -package org.hswebframework.web.entity.authorization.oauth2; +package org.hswebframework.web.authorization.oauth2.api.entity; -import org.hswebframework.web.authorization.User; import org.hswebframework.web.commons.entity.GenericEntity; import org.hswebframework.web.commons.entity.RecordCreationEntity; @@ -49,7 +48,7 @@ public interface OAuth2ClientEntity extends GenericEntity, RecordCreatio /** * @return 客户端所有者 - * @see User#getId() + * @see org.hswebframework.web.authorization.User#getId() */ String getOwnerId(); diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleAuthorizationCodeEntity.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleAuthorizationCodeEntity.java similarity index 96% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleAuthorizationCodeEntity.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleAuthorizationCodeEntity.java index 1eeea5f73..18eb41704 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleAuthorizationCodeEntity.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleAuthorizationCodeEntity.java @@ -16,7 +16,7 @@ * */ -package org.hswebframework.web.entity.authorization.oauth2; +package org.hswebframework.web.authorization.oauth2.api.entity; /** diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleOAuth2AccessEntity.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleOAuth2AccessEntity.java similarity index 97% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleOAuth2AccessEntity.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleOAuth2AccessEntity.java index b15bb74f6..baac86b6b 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleOAuth2AccessEntity.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleOAuth2AccessEntity.java @@ -16,7 +16,7 @@ * */ -package org.hswebframework.web.entity.authorization.oauth2; +package org.hswebframework.web.authorization.oauth2.api.entity; /** * TODO 完成注释 diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleOAuth2ClientEntity.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleOAuth2ClientEntity.java similarity index 97% rename from hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleOAuth2ClientEntity.java rename to hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleOAuth2ClientEntity.java index 6c0bfcaf2..44dc5ca74 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/hsweb-authorization-oauth2-server-entity/src/main/java/org/hswebframework/web/entity/authorization/oauth2/SimpleOAuth2ClientEntity.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-server/src/main/java/org/hswebframework/web/authorization/oauth2/api/entity/SimpleOAuth2ClientEntity.java @@ -16,7 +16,7 @@ * */ -package org.hswebframework.web.entity.authorization.oauth2; +package org.hswebframework.web.authorization.oauth2.api.entity; import org.hswebframework.web.commons.entity.SimpleGenericEntity;