From 04fbf5adea33ef9cc51fb425b2622c4692472d30 Mon Sep 17 00:00:00 2001
From: lishengzhao
Date: Fri, 22 May 2015 18:35:03 +0800
Subject: [PATCH] 00018 client_details list
---
.../domain/dto/OauthClientDetailsDto.java | 166 ++++++++++++++++++
.../cc/wdcy/infrastructure/DateUtils.java | 24 +++
.../controller/ClientDetailsController.java | 30 ++++
.../jsp/clientdetails/client_details.jsp | 17 ++
src/main/webapp/index.jsp | 5 +
5 files changed, 242 insertions(+)
create mode 100644 src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java
create mode 100644 src/main/java/cc/wdcy/web/controller/ClientDetailsController.java
create mode 100644 src/main/webapp/WEB-INF/jsp/clientdetails/client_details.jsp
diff --git a/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java b/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java
new file mode 100644
index 0000000..5073d30
--- /dev/null
+++ b/src/main/java/cc/wdcy/domain/dto/OauthClientDetailsDto.java
@@ -0,0 +1,166 @@
+package cc.wdcy.domain.dto;
+
+import cc.wdcy.domain.oauth.OauthClientDetails;
+import cc.wdcy.infrastructure.DateUtils;
+
+import java.io.Serializable;
+
+/**
+ * @author Shengzhao Li
+ */
+public class OauthClientDetailsDto implements Serializable {
+
+
+ private String createTime;
+ private boolean archived;
+
+ private String clientId;
+ private String resourceIds;
+
+ private String clientSecret;
+
+ private String scope;
+
+ private String authorizedGrantTypes;
+
+ private String webServerRedirectUri;
+
+ private String authorities;
+
+ private Integer accessTokenValidity;
+
+ private Integer refreshTokenValidity;
+
+ // optional
+ private String additionalInformation;
+
+ private boolean trusted;
+
+ public OauthClientDetailsDto() {
+ }
+
+ public OauthClientDetailsDto(OauthClientDetails clientDetails) {
+ this.clientId = clientDetails.clientId();
+ this.clientSecret = clientDetails.clientSecret();
+ this.scope = clientDetails.scope();
+
+ this.createTime = DateUtils.toDateTime(clientDetails.createTime());
+ this.archived = clientDetails.archived();
+ this.resourceIds = clientDetails.resourceIds();
+
+ this.webServerRedirectUri = clientDetails.webServerRedirectUri();
+ this.authorities = clientDetails.authorities();
+ this.accessTokenValidity = clientDetails.accessTokenValidity();
+
+ this.refreshTokenValidity = clientDetails.refreshTokenValidity();
+ this.additionalInformation = clientDetails.additionalInformation();
+ this.trusted = clientDetails.trusted();
+
+ this.authorizedGrantTypes = clientDetails.authorizedGrantTypes();
+ }
+
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime;
+ }
+
+ public boolean isArchived() {
+ return archived;
+ }
+
+ public void setArchived(boolean archived) {
+ this.archived = archived;
+ }
+
+ public String getClientId() {
+ return clientId;
+ }
+
+ public void setClientId(String clientId) {
+ this.clientId = clientId;
+ }
+
+ public String getResourceIds() {
+ return resourceIds;
+ }
+
+ public void setResourceIds(String resourceIds) {
+ this.resourceIds = resourceIds;
+ }
+
+ public String getClientSecret() {
+ return clientSecret;
+ }
+
+ public void setClientSecret(String clientSecret) {
+ this.clientSecret = clientSecret;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ public String getAuthorizedGrantTypes() {
+ return authorizedGrantTypes;
+ }
+
+ public void setAuthorizedGrantTypes(String authorizedGrantTypes) {
+ this.authorizedGrantTypes = authorizedGrantTypes;
+ }
+
+ public String getWebServerRedirectUri() {
+ return webServerRedirectUri;
+ }
+
+ public void setWebServerRedirectUri(String webServerRedirectUri) {
+ this.webServerRedirectUri = webServerRedirectUri;
+ }
+
+ public String getAuthorities() {
+ return authorities;
+ }
+
+ public void setAuthorities(String authorities) {
+ this.authorities = authorities;
+ }
+
+ public Integer getAccessTokenValidity() {
+ return accessTokenValidity;
+ }
+
+ public void setAccessTokenValidity(Integer accessTokenValidity) {
+ this.accessTokenValidity = accessTokenValidity;
+ }
+
+ public Integer getRefreshTokenValidity() {
+ return refreshTokenValidity;
+ }
+
+ public void setRefreshTokenValidity(Integer refreshTokenValidity) {
+ this.refreshTokenValidity = refreshTokenValidity;
+ }
+
+ public String getAdditionalInformation() {
+ return additionalInformation;
+ }
+
+ public void setAdditionalInformation(String additionalInformation) {
+ this.additionalInformation = additionalInformation;
+ }
+
+ public boolean isTrusted() {
+ return trusted;
+ }
+
+ public void setTrusted(boolean trusted) {
+ this.trusted = trusted;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/infrastructure/DateUtils.java b/src/main/java/cc/wdcy/infrastructure/DateUtils.java
index 15c0cb7..96c0414 100644
--- a/src/main/java/cc/wdcy/infrastructure/DateUtils.java
+++ b/src/main/java/cc/wdcy/infrastructure/DateUtils.java
@@ -1,12 +1,16 @@
package cc.wdcy.infrastructure;
+import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.Locale;
/**
* @author Shengzhao Li
*/
public abstract class DateUtils {
+ public static final String DEFAULT_DATE_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+
/**
* Private constructor
@@ -18,4 +22,24 @@ public abstract class DateUtils {
return new Date();
}
+
+ //Create new SimpleDateFormat
+ private static SimpleDateFormat newDateFormat(String pattern) {
+ return new SimpleDateFormat(pattern, Locale.SIMPLIFIED_CHINESE);
+ }
+
+ public static String toDateTime(Date date) {
+ return toDateText(date, DEFAULT_DATE_TIME_FORMAT);
+ }
+
+
+ public static String toDateText(Date date, String pattern) {
+ if (date == null || pattern == null) {
+ return null;
+ }
+ SimpleDateFormat dateFormat = newDateFormat(pattern);
+ return dateFormat.format(date);
+ }
+
+
}
\ No newline at end of file
diff --git a/src/main/java/cc/wdcy/web/controller/ClientDetailsController.java b/src/main/java/cc/wdcy/web/controller/ClientDetailsController.java
new file mode 100644
index 0000000..22d215c
--- /dev/null
+++ b/src/main/java/cc/wdcy/web/controller/ClientDetailsController.java
@@ -0,0 +1,30 @@
+package cc.wdcy.web.controller;
+
+import cc.wdcy.service.OauthService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+/**
+ * Handle 'client_details' management
+ *
+ * @author Shengzhao Li
+ */
+@Controller
+public class ClientDetailsController {
+
+
+ @Autowired
+ private OauthService oauthService;
+
+
+ @RequestMapping("client_details")
+ public String clientDetails(Model model) {
+
+
+ return "clientdetails/client_details";
+ }
+
+
+}
\ No newline at end of file
diff --git a/src/main/webapp/WEB-INF/jsp/clientdetails/client_details.jsp b/src/main/webapp/WEB-INF/jsp/clientdetails/client_details.jsp
new file mode 100644
index 0000000..6d21cf3
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/clientdetails/client_details.jsp
@@ -0,0 +1,17 @@
+<%--
+ *
+ * @author Shengzhao Li
+--%>
+
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+
+ client_details
+
+
+Home
+
+client_details
+
+
\ No newline at end of file
diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp
index f7c894a..6b157c4 100644
--- a/src/main/webapp/index.jsp
+++ b/src/main/webapp/index.jsp
@@ -38,6 +38,11 @@
若想访问 Unity 与 Mobile, 则先用基于浏览器的测试URL 访问,等验证通过后即可访问(注意不同的账号对应的权限).
+
+
+ 若需要自定义client_details
数据并进行测试, 可进入client_details去手动添加client_details
或删除已创建的client_details
.
+
+