Spring Security Technology stack development enterprise level Authentication and authorization (i) Environment construction

Source: Internet
Author: User
Tags xmlns

Spring security is a secure framework that provides declarative, secure access control solutions for spring-based enterprise applications. It provides a set of beans that can be configured in the context of the spring application, taking full advantage of the spring Ioc,di (control inversion inversion of controls, di:dependency injection Dependency injection) and AOP (aspect-oriented programming) capabilities provide declarative, secure access control for application systems, reducing the effort to write large amounts of repetitive code for enterprise system security controls.

The main record of this blog is learning to use the spring security technology stack to develop enterprise-level authentication and authorization. The main content of this blog is to build the environment. I. Organizational structure of the project

The following figure shows the organization of the project, where Lemon-security is the aggregation project, the package is Pom, and the other four projects are sub-modules, all of which are lemon-security and packaged in jars.

The basic role of each project is briefly described below:

Project function
Lemon-security Aggregating projects, primarily controlling which versions are dependent on the entire project
Lemon-security-core Core modules for authentication and authorization
Lemon-security-browser Browser as a client authentication and authorization module, relying on the Lemon-security-core module
Lemon-security-app Mobile as the client's authentication and authorization module, relying on the Lemon-security-core module
Lemon-security-demo Case module, dependent on Lemon-security-browser and Lemon-security-app modules
Second, Reliance lemon-security pom-dependent
<?xml version= "1.0" encoding= "UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "htt P://www.w3.org/2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apach E.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <groupid>com.lemon.security& Lt;/groupid> <artifactId>lemon-security</artifactId> <version>1.0.0-snapshot</version > <modules> <module> /lemon-security-core</module> <module> /lemon-security-browser</module> <module> /lemon-security-app</module> <module> /lemon-security-demo</module> </modules> <packaging>pom</packaging> <description&gt ; Spring Security Technology stack Development enterprise-level certification and Authorization Pom Project </description> <properties> <lemon.security.version>1.0.0-
   Snapshot</lemon.security.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>io.spring.platform</groupId> &LT;ARTIFACTID&GT;PLATFORM-BOM&LT;/ARTIFACTID&G
                T <version>Brussels-SR7</version> <type>pom</type> <scope>impo rt</scope> </dependency> <dependency> &LT;GROUPID&GT;ORG.SPRINGF
                Ramework.cloud</groupid> <artifactId>spring-cloud-dependencies</artifactId> <version>Edgware.SR2</version> <type>pom</type> <scope>i mport</scope> </dependency> </dependencies> </dependencyManagement> & lt;build> <plugins> <plugin> <groupid>org.apache.maven.plugins&lt ;/groUpid> <artifactId>maven-compiler-plugin</artifactId> &LT;VERSION&GT;3.7.0&L
                    T;/version> <configuration> <source>1.8</source> <target>1.8</target> <encoding>UTF-8</encoding> </confi guration> </plugin> </plugins> </build> </project>

The main concern in this POM file is versioning, which introduces the spring platform version control, and Spring cloud versioning, and the entire project was developed based on spring boot. Lemon-security-core's pom dependency

<?xml version= "1.0" encoding= "UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "htt P://www.w3.org/2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apach E.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <parent> <groupid& Gt;com.lemon.security</groupid> <artifactId>lemon-security</artifactId> <version>1 .0.0-snapshot</version> <relativepath>
    /lemon-security</relativepath> </parent> <artifactId>lemon-security-core</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <description>spring Se Curity Technology stack Development enterprise-level certification and authorization core projects </description> <dependencies> <!--critical reliance on app security certification-<de
     Pendency> <groupId>org.springframework.cloud</groupId>       <artifactId>spring-cloud-starter-oauth2</artifactId> </dependency> <!--Sessi On storage dependencies, temporarily unavailable, first commented out-<!--<dependency>--> <!--<groupid>org.springframework.boo
        T</groupid>--> <!--<artifactId>spring-boot-starter-data-redis</artifactId>--> <!--</dependency>--> <dependency> <groupid>org.springframework.boot</gr Oupid> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> & Lt;dependency> <groupId>mysql</groupId> <artifactid>mysql-connector-java</ Artifactid> </dependency> <!--important dependencies for third-party logins--<dependency> &lt ;groupid>org.springframework.social</groupid> &LT;ARTIFACTID&GT;SPRING-SOCIAL-CONFIG&LT;/ARTIFACTID&G
        T </dependency> <dependency> <groupId>org.springframework.social</groupId> <a rtifactid>spring-social-core</artifactid> </dependency> <dependency> &lt ;groupid>org.springframework.social</groupid> <artifactid>spring-social-security</artifactid > </dependency> <dependency> <groupid>org.springframework.social</gro Upid> <artifactId>spring-social-web</artifactId> </dependency> <!--industry Dependent-<dependency> <groupId>org.apache.commons</groupId> <artifa ctid>commons-lang3</artifactid> </dependency> <dependency> &LT;GROUPID&G T;org.apache.commons</groupid> <artifactId>commons-collections4</artifactId> &lt ; version>4.1</version> </dependency> <dependency> &LT;GROUPID&GT;COMMONS-BEANUTILS&LT;/GROUPID&G
            T <artifactId>commons-beanutils</artifactId> </dependency> </dependencies> </project >
Lemon-security-browser's pom dependency
<?xml version= "1.0" encoding= "UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "htt P://www.w3.org/2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apach E.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <parent> <groupid& Gt;com.lemon.security</groupid> <artifactId>lemon-security</artifactId> <version>1 .0.0-snapshot</version> <relativepath> 
    /lemon-security</relativepath> </parent> <artifactId>lemon-security-browser</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <description>sprin G Security Technology stack development enterprise-level certification and authorization browser projects </description> <dependencies> <dependency> <grou Pid>com.lemon.security</groupid> <artifactid>lemon-security-cOre</artifactid> <version>${lemon.security.version}</version> </dependency> <!--important dependencies of browser session management-<dependency> <groupid>org.springframework.session </groupId> <artifactId>spring-session</artifactId> </dependency> &LT;/DEP Endencies> </project>
Lemon-security-app's pom dependency
<?xml version= "1.0" encoding= "UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "htt P://www.w3.org/2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apach E.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <parent> <groupid& Gt;com.lemon.security</groupid> <artifactId>lemon-security</artifactId> <version>1 .0.0-snapshot</version> <relativepath>
    /lemon-security</relativepath> </parent> <artifactId>lemon-security-app</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>jar</packaging> <description>spring Se Curity Technology stack Development enterprise-level certification and licensing mobile projects </description> <dependencies> <dependency> <groupid& Gt;com.lemon.security</groupid> <artifactid>lemon-security-core</artifactid> <version>${lemon.security.version}</version> </dependency> &L T;/dependencies> </project>
Lemon-security-demo's pom dependency
<?xml version= "1.0" encoding= "UTF-8"?> <project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "htt P://www.w3.org/2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 Http://maven.apach E.org/xsd/maven-4.0.0.xsd "> <modelVersion>4.0.0</modelVersion> <parent> <groupid& Gt;com.lemon.security</groupid> <artifactId>lemon-security</artifactId> <version>1 .0.0-snapshot</version> <relativepath>
    /lemon-security</relativepath> </parent> <artifactId>lemon-security-demo</artifactId> <version>${lemon.security.version}</version> <packaging>jar</packaging> <description& Gt
        Spring Security Technology stack Development enterprise certification and authorization case Project </description> <dependencies> <!--The first thing to learn is browser-side security development--
<dependency> <groupId>com.lemon.security</groupId>            <artifactId>lemon-security-browser</artifactId> <version>${lemon.security.versio n}</version> </dependency> <dependency> <groupid>com.alibaba</grou Pid> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.9</ve rsion> </dependency> <dependency> <groupid>org.springframework.boot</ groupid> <artifactId>spring-boot-starter-test</artifactId> </dependency> &lt ;/dependencies> <build> <plugins> <!--Spring Boot app Pack-and-&lt ;p lugin> <groupId>org.springframework.boot</groupId> <artifactid>spri Ng-boot-maven-plugin</artifactid> <version>1.5.10.RELEASE</version> <
         Executions>            

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.