單點登錄-系統搭建

来源:http://www.cnblogs.com/liyasong/archive/2017/02/14/sso_dj.html
-Advertisement-
Play Games

sso單點登錄系統的最全的搭建方法,只要你按我的步驟來,就可以成功的搭建出你的sso單點登錄系統。 ...


  之前說了單點登錄系統的原理,這篇就來點硬貨,說下單點登錄的一個系統是如何搭建的。

 架構分析

    表現層:提供手機客戶端,或其他系統的調用

      表現層的存在意義就是,提供給所有非本系統的其他系統進行登錄。具體實現的思路就是,編寫一個登錄的介面(本系統使用RESTful風格的),讓需要該服務的其他系統通過介面提交數據,並獲得相應的返回。

    服務層:系統內部的調用

      這個比較簡單了,內部的所有登錄,查詢的操作都是通過服務層去實現的。

    我們本次的搭建使用maven實現的,如果使用其他技術,請自行從網上查找其他資料

    服務層

    首先是我們的服務層,我們的服務層中總共只有三個子項目:分別是聚合工程的父工程(taotao-sso)還有就是兩個子工程,負責提供介面和依賴的介面工程(taotao-sso-interface)和負責真正的業務處理的業務處理工程(taotao-sso-service)。跟其他聚合工程的的服務層相比,它的裡面是沒有實體層(pojo)和持久層(mapper)的。因為項目中一般所有的資料庫表都是有一個專門的團隊去維護的(資料庫開發工程師),目的是保證數據的安全性、讀取速度等。所以對應的實體層(pojo)和持久層(mapper)的編寫一般也都是由他們來進行完成的。

    而我們的單點登錄系統肯定是要使用實體和持久層的,這個時候,我們需要依賴後臺的pojo和mapper就可以了。

     表現層

    表現層主要提供介面給別的系統用,就是一個普通的表現層web工程。

 搭建

  搭建taotao-sso

   創建工程

    創建聚合工程父工程

    

    

    

    創建聚合工程子工程-interface

    

    

    

    創建聚合工程子工程-service

     

    

 

   加入依賴(就是pom.xml文件中的代碼)

    這裡依賴的那個parent的包下的xml文件也一併提供下,建工程的過程就不寫了,參見taotao-sso

    
  1 <project xmlns="http://maven.apache.org/POM/4.0.0" 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">
  2   <modelVersion>4.0.0</modelVersion>
  3   <groupId>com.taotao</groupId>
  4   <artifactId>taotao-parent</artifactId>
  5   <version>0.0.1-SNAPSHOT</version>
  6   <packaging>pom</packaging>
  7   
  8       <!-- 集中定義依賴版本號 -->
  9     <properties>
 10         <junit.version>4.12</junit.version>
 11         <spring.version>4.1.3.RELEASE</spring.version>
 12         <mybatis.version>3.2.7</mybatis.version>
 13         <mybatis.spring.version>1.2.2</mybatis.spring.version>
 14         <mybatis.paginator.version>1.2.15</mybatis.paginator.version>
 15         <mysql.version>5.1.32</mysql.version>
 16         <slf4j.version>1.6.4</slf4j.version>
 17         <jackson.version>2.4.2</jackson.version>
 18         <druid.version>1.0.9</druid.version>
 19         <jolbox.version>0.8.0.RELEASE</jolbox.version>
 20         <jstl.version>1.2</jstl.version>
 21         <servlet-api.version>2.5</servlet-api.version>
 22         <jsp-api.version>2.0</jsp-api.version>
 23         <joda-time.version>2.5</joda-time.version>
 24         <commons-lang3.version>3.3.2</commons-lang3.version>
 25         <commons-io.version>1.3.2</commons-io.version>
 26         <commons-net.version>3.3</commons-net.version>
 27         <pagehelper.version>3.7.5</pagehelper.version>
 28         <mapper.version>2.3.4</mapper.version>
 29         <jsqlparser.version>0.9.1</jsqlparser.version>
 30         <commons-fileupload.version>1.3.1</commons-fileupload.version>
 31         <commons-codec.version>1.9</commons-codec.version>
 32         <jedis.version>2.7.2</jedis.version>
 33         <solrj.version>4.10.3</solrj.version>
 34         <dubbo.version>2.5.3</dubbo.version>
 35         <zookeeper.version>3.4.7</zookeeper.version>
 36         <zkclient.version>0.1</zkclient.version>
 37         <activemq.version>5.12.0</activemq.version>
 38         <freemarker.version>2.3.23</freemarker.version>
 39         <quartz.version>2.2.2</quartz.version>
 40     </properties>
 41 
 42     <dependencies>
 43         <!-- 單元測試 -->
 44         <dependency>
 45             <groupId>junit</groupId>
 46             <artifactId>junit</artifactId>
 47             <version>${junit.version}</version>
 48             <scope>test</scope>
 49         </dependency>
 50 
 51         <!-- Spring -->
 52         <dependency>
 53             <groupId>org.springframework</groupId>
 54             <artifactId>spring-webmvc</artifactId>
 55             <version>${spring.version}</version>
 56         </dependency>
 57         <dependency>
 58             <groupId>org.springframework</groupId>
 59             <artifactId>spring-jdbc</artifactId>
 60             <version>${spring.version}</version>
 61         </dependency>
 62         <dependency>
 63             <groupId>org.springframework</groupId>
 64             <artifactId>spring-aspects</artifactId>
 65             <version>${spring.version}</version>
 66         </dependency>
 67         <dependency>
 68             <groupId>org.springframework</groupId>
 69             <artifactId>spring-context-support</artifactId>
 70             <version>${spring.version}</version>
 71         </dependency>
 72 
 73         <!-- Mybatis -->
 74         <dependency>
 75             <groupId>org.mybatis</groupId>
 76             <artifactId>mybatis</artifactId>
 77             <version>${mybatis.version}</version>
 78         </dependency>
 79         <dependency>
 80             <groupId>org.mybatis</groupId>
 81             <artifactId>mybatis-spring</artifactId>
 82             <version>${mybatis.spring.version}</version>
 83         </dependency>
 84 
 85         <!-- 通用Mapper -->
 86         <dependency>
 87             <groupId>com.github.abel533</groupId>
 88             <artifactId>mapper</artifactId>
 89             <version>${mapper.version}</version>
 90         </dependency>
 91 
 92         <!-- 分頁助手 -->
 93         <dependency>
 94             <groupId>com.github.pagehelper</groupId>
 95             <artifactId>pagehelper</artifactId>
 96             <version>${pagehelper.version}</version>
 97         </dependency>
 98         <dependency>
 99             <groupId>com.github.jsqlparser</groupId>
100             <artifactId>jsqlparser</artifactId>
101             <version>${jsqlparser.version}</version>
102         </dependency>
103 
104         <!-- MySql -->
105         <dependency>
106             <groupId>mysql</groupId>
107             <artifactId>mysql-connector-java</artifactId>
108             <version>${mysql.version}</version>
109         </dependency>
110 
111         <!-- 日誌 -->
112         <dependency>
113             <groupId>org.slf4j</groupId>
114             <artifactId>slf4j-log4j12</artifactId>
115             <version>${slf4j.version}</version>
116         </dependency>
117 
118         <!-- Jackson Json處理工具包 -->
119         <dependency>
120             <groupId>com.fasterxml.jackson.core</groupId>
121             <artifactId>jackson-databind</artifactId>
122             <version>${jackson.version}</version>
123         </dependency>
124 
125         <!-- 連接池 -->
126         <dependency>
127             <groupId>com.jolbox</groupId>
128             <artifactId>bonecp-spring</artifactId>
129             <version>${jolbox.version}</version>
130         </dependency>
131 
132         <!-- JSP相關 -->
133         <dependency>
134             <groupId>jstl</groupId>
135             <artifactId>jstl</artifactId>
136             <version>${jstl.version}</version>
137         </dependency>
138         <dependency>
139             <groupId>javax.servlet</groupId>
140             <artifactId>servlet-api</artifactId>
141             <version>${servlet-api.version}</version>
142             <scope>provided</scope>
143         </dependency>
144         <dependency>
145             <groupId>javax.servlet</groupId>
146             <artifactId>jsp-api</artifactId>
147             <version>${jsp-api.version}</version>
148             <scope>provided</scope>
149         </dependency>
150 
151         <!-- 時間操作組件 -->
152         <dependency>
153             <groupId>joda-time</groupId>
154             <artifactId>joda-time</artifactId>
155             <version>${joda-time.version}</version>
156         </dependency>
157 
158         <!-- Apache工具組件 -->
159         <dependency>
160             <groupId>org.apache.commons</groupId>
161             <artifactId>commons-lang3</artifactId>
162             <version>${commons-lang3.version}</version>
163         </dependency>
164         <dependency>
165             <groupId>org.apache.commons</groupId>
166             <artifactId>commons-io</artifactId>
167             <version>${commons-io.version}</version>
168         </dependency>
169 
170         <!-- 文件上傳組件 -->
171         <dependency>
172             <groupId>commons-fileupload</groupId>
173             <artifactId>commons-fileupload</artifactId>
174             <version>${commons-fileupload.version}</version>
175         </dependency>
176 
177         <!-- dubbo相關 -->
178         <dependency>
179             <groupId>com.alibaba</groupId>
180             <artifactId>dubbo</artifactId>
181             <version>${dubbo.version}</version>
182             <exclusions>
183                 <exclusion>
184                     <groupId>org.springframework</groupId>
185                     <artifactId>spring</artifactId>
186                 </exclusion>
187                 <exclusion>
188                     <groupId>org.jboss.netty</groupId>
189                     <artifactId>netty</artifactId>
190                 </exclusion>
191             </exclusions>
192         </dependency>
193         <dependency>
194             <groupId>org.apache.zookeeper</groupId>
195             <artifactId>zookeeper</artifactId>
196             <version>${zookeeper.version}</version>
197         </dependency>
198         <dependency>
199             <groupId>com.github.sgroschupf</groupId>
200             <artifactId>zkclient</artifactId>
201             <version>${zkclient.version}</version>
202         </dependency>
203 
204         <!-- 加密解密 -->
205         <dependency>
206             <groupId>commons-codec</groupId>
207             <artifactId>commons-codec</artifactId>
208             <version>${commons-codec.version}</version>
209         </dependency>
210 
211         <!-- 定時任務Quartz -->
212         <dependency>
213             <groupId>org.quartz-scheduler</groupId>
214             <artifactId>quartz</artifactId>
215             <version>2.2.1</version>
216         </dependency>
217         
218         <!-- ActiveMQ依賴 -->
219         <dependency>
220             <groupId>org.apache.activemq</groupId>
221             <artifactId>activemq-all</artifactId>
222             <version>${activemq.version}</version>
223         </dependency>
224         <dependency>
225             <groupId>org.springframework</groupId>
226             <artifactId>spring-jms</artifactId>
227             <version>${spring.version}</version>
228         </dependency>
229 
230         <!-- 靜態化freemarker -->
231         <dependency>
232             <groupId>org.freemarker</groupId>
233             <artifactId>freemarker</artifactId>
234             <version>${freemarker.version}</version>
235         </dependency>
236         
237         <!-- Redis客戶端 -->
238         <dependency>
239             <groupId>redis.clients</groupId>
240             <artifactId>jedis</artifactId>
241             <version>${jedis.version}</version>
242         </dependency>
243         
244         <!-- solr客戶端 -->
245         <dependency>
246             <groupId>org.apache.solr</groupId>
247             <artifactId>solr-solrj</artifactId>
248             <version>${solrj.version}</version>
249         </dependency>
250 
251     </dependencies>
252 
253     <build>
254         <finalName>${project.artifactId}</finalName>
255         <
              
您的分享是我們最大的動力!

-Advertisement-
Play Games
更多相關文章
  • 輸入n個整數,如何求出其中最小的k個數? 解法1. 當然最直觀的思路是將數組排序,然後就可以找出其中最小的k個數了,時間複雜度以快速排序為例,是O(nlogn); 解法2. 藉助劃分(Partition)的思路,一次劃分可以把樞軸使得樞軸左邊的元素都比樞軸小,樞軸右邊的元素都比樞軸大(可以參考快速排 ...
  • struts2框架 如果你之前在MVC模式的時候一直都是通過servlet,獲取和返回數據,那麼現在開始學習struts2框架, Struts是一個實現MVC設計模式的優秀的框架。它的許多優點我就不說了。 我用自己做的一張圖說明servlet和struts2的區別。 寫一個最基本的開發步驟,完成開發 ...
  • 一.騰訊優圖 1.開發者地址:http://open.youtu.qq.com/welcome/developer 2.接入流程:按照開發者頁面的接入流程接入之後,創建應用即可獲得所需的AppID、SecretID和SecretKey這是進行介面調用必須的憑證 3.測試流程: 3.1.測試可以直接調 ...
  • 這裡並未涉及到JSR181Annotations的相關應用,具體的三種方式如下 ①通過WSDL地址來創建動態客戶端②通過服務端提供的介面來創建客戶端③使用Ant通過WSDL文件來生成客戶端 第一種方式:通過WSDL地址來創建動態客戶端 view plainprint? ...
  • 列印thinkphp中的sql語句 var_dump($repair->fetchSql(true)->where(array('cuername' =>$cuername))->order('applytime desc')->limit($page1*$listRows,$listRows)-> ...
  • 歡迎大家來咨詢海南七星彩打獎系統,系統可以支持手機下註的南方海南,湛江七星彩投註網站系統,也可以出租,出售等渠道,或者定製,可以選擇支持手機下註或者不支持,需要定製的,可以私信,扣扣:1930-1335-70 本截圖只作為演示,如有需要定製,購買,請聯繫客服購買正版授權使用。 會員演示圖: 代理演示 ...
  • 1 import java.util.*; 2 class CalendarTest 3 { 4 /*先輸出提示語句,並接受用戶輸入的年、月。 5 根據用戶輸入的年,先判斷是否是閏年。 6 根據用戶輸入的年份來判斷月的天數。 7 用迴圈計算用戶輸入的年份距1900年1月1日的總天數。 8 用迴圈計算... ...
  • mybatis和hibernate之間的對比。及應用場景的介紹 ...
一周排行
    -Advertisement-
    Play Games
  • 示例項目結構 在 Visual Studio 中創建一個 WinForms 應用程式後,項目結構如下所示: MyWinFormsApp/ │ ├───Properties/ │ └───Settings.settings │ ├───bin/ │ ├───Debug/ │ └───Release/ ...
  • [STAThread] 特性用於需要與 COM 組件交互的應用程式,尤其是依賴單線程模型(如 Windows Forms 應用程式)的組件。在 STA 模式下,線程擁有自己的消息迴圈,這對於處理用戶界面和某些 COM 組件是必要的。 [STAThread] static void Main(stri ...
  • 在WinForm中使用全局異常捕獲處理 在WinForm應用程式中,全局異常捕獲是確保程式穩定性的關鍵。通過在Program類的Main方法中設置全局異常處理,可以有效地捕獲並處理未預見的異常,從而避免程式崩潰。 註冊全局異常事件 [STAThread] static void Main() { / ...
  • 前言 給大家推薦一款開源的 Winform 控制項庫,可以幫助我們開發更加美觀、漂亮的 WinForm 界面。 項目介紹 SunnyUI.NET 是一個基於 .NET Framework 4.0+、.NET 6、.NET 7 和 .NET 8 的 WinForm 開源控制項庫,同時也提供了工具類庫、擴展 ...
  • 說明 該文章是屬於OverallAuth2.0系列文章,每周更新一篇該系列文章(從0到1完成系統開發)。 該系統文章,我會儘量說的非常詳細,做到不管新手、老手都能看懂。 說明:OverallAuth2.0 是一個簡單、易懂、功能強大的許可權+可視化流程管理系統。 有興趣的朋友,請關註我吧(*^▽^*) ...
  • 一、下載安裝 1.下載git 必須先下載並安裝git,再TortoiseGit下載安裝 git安裝參考教程:https://blog.csdn.net/mukes/article/details/115693833 2.TortoiseGit下載與安裝 TortoiseGit,Git客戶端,32/6 ...
  • 前言 在項目開發過程中,理解數據結構和演算法如同掌握蓋房子的秘訣。演算法不僅能幫助我們編寫高效、優質的代碼,還能解決項目中遇到的各種難題。 給大家推薦一個支持C#的開源免費、新手友好的數據結構與演算法入門教程:Hello演算法。 項目介紹 《Hello Algo》是一本開源免費、新手友好的數據結構與演算法入門 ...
  • 1.生成單個Proto.bat內容 @rem Copyright 2016, Google Inc. @rem All rights reserved. @rem @rem Redistribution and use in source and binary forms, with or with ...
  • 一:背景 1. 講故事 前段時間有位朋友找到我,說他的窗體程式在客戶這邊出現了卡死,讓我幫忙看下怎麼回事?dump也生成了,既然有dump了那就上 windbg 分析吧。 二:WinDbg 分析 1. 為什麼會卡死 窗體程式的卡死,入口門檻很低,後續往下分析就不一定了,不管怎麼說先用 !clrsta ...
  • 前言 人工智慧時代,人臉識別技術已成為安全驗證、身份識別和用戶交互的關鍵工具。 給大家推薦一款.NET 開源提供了強大的人臉識別 API,工具不僅易於集成,還具備高效處理能力。 本文將介紹一款如何利用這些API,為我們的項目添加智能識別的亮點。 項目介紹 GitHub 上擁有 1.2k 星標的 C# ...