Browse Source

first commit

tags/V2.2.0
chenjiandong 2 years ago
parent
commit
5c2413a87d
32 changed files with 54 additions and 17 deletions
  1. +15
    -3
      pom.xml
  2. +28
    -6
      tuoheng_oidc_server/pom.xml
  3. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/SpringAuthorizationServerApplication.java
  4. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/config/AuthorizationServerConfig.java
  5. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/config/IdTokenCustomizerConfig.java
  6. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/config/JWKSourceConfig.java
  7. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/config/MyCorsFilter.java
  8. +11
    -8
      tuoheng_oidc_server/src/main/java/com/tuoheng/config/SecurityConfig.java
  9. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/controller/HealthController.java
  10. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/controller/Oauth2Controller.java
  11. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/controller/UserController.java
  12. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/mapper/AuthoritiesMapper.java
  13. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/mapper/UserMapper.java
  14. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/UserBaseInfoDto.java
  15. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/param/CreateUserDto.java
  16. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/po/AuthoritiesPo.java
  17. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/po/UserPo.java
  18. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/OidcUserInfoService.java
  19. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/UserSevice.java
  20. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/OidcUserInfoServiceImpl.java
  21. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/UserServiceImpl.java
  22. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/until/CryptoUtil.java
  23. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/until/JsonResult.java
  24. +0
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/until/RegisteredClientUtil.java
  25. +0
    -0
      tuoheng_oidc_server/src/main/resources/application-dev.yml
  26. +0
    -0
      tuoheng_oidc_server/src/main/resources/application-local.yml
  27. +0
    -0
      tuoheng_oidc_server/src/main/resources/application-prod.yml
  28. +0
    -0
      tuoheng_oidc_server/src/main/resources/application-test.yml
  29. +0
    -0
      tuoheng_oidc_server/src/main/resources/application.yml
  30. +0
    -0
      tuoheng_oidc_server/src/main/resources/mapper/AuthoritiesMapper.xml
  31. +0
    -0
      tuoheng_oidc_server/src/main/resources/mapper/UserMapper.xml
  32. +0
    -0
      tuoheng_oidc_server/src/main/resources/templates/login.html

+ 15
- 3
pom.xml View File

<version>2.7.3</version> <version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
<modules>
<module>tuoheng_oidc_server</module>
</modules>
<groupId>com.tuoheng</groupId> <groupId>com.tuoheng</groupId>
<artifactId>tuoheng_oidc</artifactId> <artifactId>tuoheng_oidc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.0.0</version>
<name>tuoheng_oidc</name> <name>tuoheng_oidc</name>
<description>tuoheng_oidc</description> <description>tuoheng_oidc</description>
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<tuoheng.version>1.0.0</tuoheng.version>
</properties> </properties>
<dependencies> <dependencies>
<dependency> <dependency>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

<dependency>
<groupId>com.tuoheng</groupId>
<artifactId>tuoheng_oidc_server</artifactId>
<version>${tuoheng.version}</version>
</dependency>

</dependencies> </dependencies>


<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

Spring_Authorization_Server/pom.xml → tuoheng_oidc_server/pom.xml View File

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
<artifactId>tuoheng_oidc</artifactId>
<groupId>com.tuoheng</groupId>
<version>1.0.0</version>
</parent> </parent>
<groupId>com.tuoheng</groupId> <groupId>com.tuoheng</groupId>
<artifactId>tuoheng_oidc_server</artifactId> <artifactId>tuoheng_oidc_server</artifactId>
</profile> </profile>
</profiles> </profiles>


<!-- 环境变量构建 -->
<build> <build>
<finalName>tuoheng_dsp_system</finalName>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
</includes> </includes>
</resource> </resource>
</resources> </resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.11.RELEASE</version>
<configuration>
<finalName>${project.build.finalName}</finalName>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</pluginManagement>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

Spring_Authorization_Server/src/main/java/com/tuoheng/SpringAuthorizationServerApplication.java → tuoheng_oidc_server/src/main/java/com/tuoheng/SpringAuthorizationServerApplication.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/config/AuthorizationServerConfig.java → tuoheng_oidc_server/src/main/java/com/tuoheng/config/AuthorizationServerConfig.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/config/IdTokenCustomizerConfig.java → tuoheng_oidc_server/src/main/java/com/tuoheng/config/IdTokenCustomizerConfig.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/config/JWKSourceConfig.java → tuoheng_oidc_server/src/main/java/com/tuoheng/config/JWKSourceConfig.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/config/MyCorsFilter.java → tuoheng_oidc_server/src/main/java/com/tuoheng/config/MyCorsFilter.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/config/SecurityConfig.java → tuoheng_oidc_server/src/main/java/com/tuoheng/config/SecurityConfig.java View File

import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer; import org.springframework.security.config.annotation.web.configurers.oauth2.server.authorization.OAuth2AuthorizationServerConfigurer;
import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer; import org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService; import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.oauth2.core.oidc.OidcUserInfo; import org.springframework.security.oauth2.core.oidc.OidcUserInfo;
import org.springframework.security.oauth2.server.authorization.config.ProviderSettings; import org.springframework.security.oauth2.server.authorization.config.ProviderSettings;
import org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationContext; import org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationContext;
import org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationToken; import org.springframework.security.oauth2.server.authorization.oidc.authentication.OidcUserInfoAuthenticationToken;
import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationToken;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.provisioning.JdbcUserDetailsManager; import org.springframework.security.provisioning.JdbcUserDetailsManager;
import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint; import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;


@Bean @Bean
public UserDetailsService userDetailsService() { public UserDetailsService userDetailsService() {
// UserDetails userDetails = User.withDefaultPasswordEncoder()
// .username("admin")
// .password("123456")
// .roles("USER")
// .build();
//
// return new InMemoryUserDetailsManager(userDetails);
return new JdbcUserDetailsManager(dataSource);
UserDetails userDetails = User.withDefaultPasswordEncoder()
.username("admin")
.password("123456")
.roles("ADMIN")
.build();
return new InMemoryUserDetailsManager(userDetails);
//return new JdbcUserDetailsManager(dataSource);
} }


@Bean @Bean

Spring_Authorization_Server/src/main/java/com/tuoheng/controller/HealthController.java → tuoheng_oidc_server/src/main/java/com/tuoheng/controller/HealthController.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/controller/Oauth2Controller.java → tuoheng_oidc_server/src/main/java/com/tuoheng/controller/Oauth2Controller.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/controller/UserController.java → tuoheng_oidc_server/src/main/java/com/tuoheng/controller/UserController.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/mapper/AuthoritiesMapper.java → tuoheng_oidc_server/src/main/java/com/tuoheng/mapper/AuthoritiesMapper.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/mapper/UserMapper.java → tuoheng_oidc_server/src/main/java/com/tuoheng/mapper/UserMapper.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/model/dto/UserBaseInfoDto.java → tuoheng_oidc_server/src/main/java/com/tuoheng/model/dto/UserBaseInfoDto.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/model/param/CreateUserDto.java → tuoheng_oidc_server/src/main/java/com/tuoheng/model/param/CreateUserDto.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/model/po/AuthoritiesPo.java → tuoheng_oidc_server/src/main/java/com/tuoheng/model/po/AuthoritiesPo.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/model/po/UserPo.java → tuoheng_oidc_server/src/main/java/com/tuoheng/model/po/UserPo.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/service/OidcUserInfoService.java → tuoheng_oidc_server/src/main/java/com/tuoheng/service/OidcUserInfoService.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/service/UserSevice.java → tuoheng_oidc_server/src/main/java/com/tuoheng/service/UserSevice.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/service/impl/OidcUserInfoServiceImpl.java → tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/OidcUserInfoServiceImpl.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/service/impl/UserServiceImpl.java → tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/UserServiceImpl.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/until/CryptoUtil.java → tuoheng_oidc_server/src/main/java/com/tuoheng/until/CryptoUtil.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/until/JsonResult.java → tuoheng_oidc_server/src/main/java/com/tuoheng/until/JsonResult.java View File


Spring_Authorization_Server/src/main/java/com/tuoheng/until/RegisteredClientUtil.java → tuoheng_oidc_server/src/main/java/com/tuoheng/until/RegisteredClientUtil.java View File


Spring_Authorization_Server/src/main/resources/application-dev.yml → tuoheng_oidc_server/src/main/resources/application-dev.yml View File


Spring_Authorization_Server/src/main/resources/application-local.yml → tuoheng_oidc_server/src/main/resources/application-local.yml View File


Spring_Authorization_Server/src/main/resources/application-prod.yml → tuoheng_oidc_server/src/main/resources/application-prod.yml View File


Spring_Authorization_Server/src/main/resources/application-test.yml → tuoheng_oidc_server/src/main/resources/application-test.yml View File


Spring_Authorization_Server/src/main/resources/application.yml → tuoheng_oidc_server/src/main/resources/application.yml View File


Spring_Authorization_Server/src/main/resources/mapper/AuthoritiesMapper.xml → tuoheng_oidc_server/src/main/resources/mapper/AuthoritiesMapper.xml View File


Spring_Authorization_Server/src/main/resources/mapper/UserMapper.xml → tuoheng_oidc_server/src/main/resources/mapper/UserMapper.xml View File


Spring_Authorization_Server/src/main/resources/templates/login.html → tuoheng_oidc_server/src/main/resources/templates/login.html View File


Loading…
Cancel
Save