forked from zhangwei900808/awbeci-ssb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8e1ce9f
commit 2ff5280
Showing
14 changed files
with
375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
logs/ | ||
|
||
.idea/ | ||
target/ | ||
|
||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
|
||
.idea_modules/ | ||
/out/ | ||
|
||
.settings/ | ||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<parent> | ||
<artifactId>awbeci-ssb-parent</artifactId> | ||
<groupId>com.awbeci.ssb</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>awbeci-ssb-api</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.awbeci.ssb</groupId> | ||
<artifactId>awbeci-ssb-app</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-aop</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger2</artifactId> | ||
<version>2.7.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.springfox</groupId> | ||
<artifactId>springfox-swagger-ui</artifactId> | ||
<version>2.7.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.github.tomakehurst</groupId> | ||
<artifactId>wiremock</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
11 changes: 11 additions & 0 deletions
11
awbeci-ssb-api/src/main/java/com/awbeci/ssb/SsbApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.awbeci.ssb; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class SsbApplication { | ||
public static void main(String[] args) { | ||
SpringApplication.run(SsbApplication.class, args); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
awbeci-ssb-api/src/main/java/com/awbeci/ssb/controller/Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.awbeci.ssb.controller; | ||
|
||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@RestController | ||
public class Test { | ||
|
||
@GetMapping("/test") | ||
public String test(){ | ||
return "test"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
server.port=10001 | ||
#\u914D\u7F6Emysql\u6570\u636E\u6E90 | ||
spring.datasource.url=jdbc:mysql://rm-bp1q72l45bfudwh49no.mysql.rds.aliyuncs.com/xfind?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true | ||
spring.datasource.username=xfind_admin | ||
spring.datasource.password=Xfind123 | ||
spring.datasource.driverClassName=com.mysql.jdbc.Driver | ||
|
||
spring.session.store-type=none | ||
security.oauth2.client.client-id=awbeci | ||
security.oauth2.client.client-secret=awbecis |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<parent> | ||
<artifactId>awbeci-ssb-parent</artifactId> | ||
<groupId>com.awbeci.ssb</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>awbeci-ssb-app</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.awbeci.ssb</groupId> | ||
<artifactId>awbeci-ssb-core</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
34 changes: 34 additions & 0 deletions
34
...p/src/main/java/com/awbeci/ssb/app/authentication/AwbeciAuthenctiationFailureHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.awbeci.ssb.app.authentication; | ||
|
||
import com.awbeci.ssb.core.properties.SecurityProperties; | ||
import com.awbeci.ssb.core.support.SimpleResponse; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.security.core.AuthenticationException; | ||
import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
@Component("awbeciAuthenctiationFailureHandler") | ||
public class AwbeciAuthenctiationFailureHandler extends SimpleUrlAuthenticationFailureHandler { | ||
@Autowired | ||
private ObjectMapper objectMapper; | ||
|
||
|
||
/* (non-Javadoc) | ||
* @see org.springframework.security.web.authentication.AuthenticationFailureHandler#onAuthenticationFailure(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, org.springframework.security.core.AuthenticationException) | ||
*/ | ||
@Override | ||
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, | ||
AuthenticationException exception) throws IOException, ServletException { | ||
|
||
super.onAuthenticationFailure(request, response, exception); | ||
|
||
|
||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
...p/src/main/java/com/awbeci/ssb/app/authentication/AwbeciAuthenticationSuccessHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.awbeci.ssb.app.authentication; | ||
|
||
import com.awbeci.ssb.core.properties.SecurityProperties; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.security.core.Authentication; | ||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.io.IOException; | ||
|
||
@Component("awbeciAuthenticationSuccessHandler") | ||
public class AwbeciAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler { | ||
|
||
@Autowired | ||
private ObjectMapper objectMapper; | ||
|
||
/* | ||
* (non-Javadoc) | ||
* | ||
* @see org.springframework.security.web.authentication. | ||
* AuthenticationSuccessHandler#onAuthenticationSuccess(javax.servlet.http. | ||
* HttpServletRequest, javax.servlet.http.HttpServletResponse, | ||
* org.springframework.security.core.Authentication) | ||
*/ | ||
@Override | ||
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, | ||
Authentication authentication) throws IOException, ServletException { | ||
|
||
super.onAuthenticationSuccess(request, response, authentication); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
awbeci-ssb-app/src/main/java/com/awbeci/ssb/app/server/AwbeciAuthorizationServerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.awbeci.ssb.app.server; | ||
|
||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; | ||
|
||
@Configuration | ||
@EnableAuthorizationServer | ||
public class AwbeciAuthorizationServerConfig { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<parent> | ||
<artifactId>awbeci-ssb-parent</artifactId> | ||
<groupId>com.awbeci.ssb</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>awbeci-ssb-core</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.security.oauth</groupId> | ||
<artifactId>spring-security-oauth2</artifactId> | ||
<version>2.3.3.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-security</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.cloud</groupId> | ||
<artifactId>spring-cloud-starter-oauth2</artifactId> | ||
<version>2.0.0.RELEASE</version> | ||
</dependency> | ||
<!--<dependency>--> | ||
<!--<groupId>org.springframework.boot</groupId>--> | ||
<!--<artifactId>spring-boot-starter-data-redis</artifactId>--> | ||
<!--</dependency>--> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-jdbc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>mysql</groupId> | ||
<artifactId>mysql-connector-java</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.social</groupId> | ||
<artifactId>spring-social-config</artifactId> | ||
<version>1.1.6.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.social</groupId> | ||
<artifactId>spring-social-core</artifactId> | ||
<version>1.1.6.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.social</groupId> | ||
<artifactId>spring-social-security</artifactId> | ||
<version>1.1.6.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.social</groupId> | ||
<artifactId>spring-social-web</artifactId> | ||
<version>1.1.6.RELEASE</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-lang3</artifactId> | ||
<version>3.7</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.commons</groupId> | ||
<artifactId>commons-collections4</artifactId> | ||
<version>4.2</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>commons-beanutils</groupId> | ||
<artifactId>commons-beanutils</artifactId> | ||
<version>1.9.3</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
18 changes: 18 additions & 0 deletions
18
awbeci-ssb-core/src/main/java/com/awbeci/ssb/core/SecurityCoreConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.awbeci.ssb.core; | ||
|
||
import org.springframework.boot.autoconfigure.security.SecurityProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties(SecurityProperties.class) | ||
public class SecurityCoreConfig { | ||
|
||
@Bean | ||
public PasswordEncoder passwordEncoder() { | ||
return new BCryptPasswordEncoder(); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
awbeci-ssb-core/src/main/java/com/awbeci/ssb/core/properties/SecurityProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.awbeci.ssb.core.properties; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
|
||
@ConfigurationProperties(prefix = "imooc.security") | ||
public class SecurityProperties { | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
awbeci-ssb-core/src/main/java/com/awbeci/ssb/core/support/SimpleResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.awbeci.ssb.core.support; | ||
|
||
/** | ||
* Created by zhangwei on 2018/8/13. | ||
*/ | ||
public class SimpleResponse { | ||
public SimpleResponse(Object content){ | ||
this.content = content; | ||
} | ||
|
||
private Object content; | ||
|
||
public Object getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(Object content) { | ||
this.content = content; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.awbeci.ssb</groupId> | ||
<artifactId>awbeci-ssb-parent</artifactId> | ||
<packaging>pom</packaging> | ||
<version>1.0-SNAPSHOT</version> | ||
<modules> | ||
<module>awbeci-ssb-core</module> | ||
<module>awbeci-ssb-app</module> | ||
<module>awbeci-ssb-api</module> | ||
</modules> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<!-- Override Spring Data release train provided by Spring Boot --> | ||
<dependency> | ||
<groupId>org.springframework.data</groupId> | ||
<artifactId>spring-data-releasetrain</artifactId> | ||
<version>Fowler-SR2</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-dependencies</artifactId> | ||
<version>2.0.4.RELEASE</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<!--<parent>--> | ||
<!--<groupId>org.springframework.boot</groupId>--> | ||
<!--<artifactId>spring-boot-starter-parent</artifactId>--> | ||
<!--<version>2.0.3.RELEASE</version>--> | ||
<!--</parent>--> | ||
</project> |