게이트웨이 인증 코드 수정 및 버전 증가
This commit is contained in:
17
pom.xml
17
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>2.1.4.RELEASE</version>
|
<version>2.3.1.RELEASE</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.example</groupId>
|
<groupId>com.example</groupId>
|
||||||
@@ -39,10 +39,14 @@
|
|||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-oauth2-jose</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.security.oauth.boot</groupId>
|
<groupId>org.springframework.security.oauth.boot</groupId>
|
||||||
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
<artifactId>spring-security-oauth2-autoconfigure</artifactId>
|
||||||
<version>2.1.4.RELEASE</version>
|
<version>2.3.1.RELEASE</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -50,15 +54,6 @@
|
|||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
|
||||||
<!-- <artifactId>spring-boot-starter-jdbc</artifactId>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<!-- <dependency>-->
|
|
||||||
<!-- <groupId>mysql</groupId>-->
|
|
||||||
<!-- <artifactId>mysql-connector-java</artifactId>-->
|
|
||||||
<!-- <scope>runtime</scope>-->
|
|
||||||
<!-- </dependency>-->
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.example.template.config;
|
||||||
|
|
||||||
|
import com.nimbusds.jose.jwk.JWKSet;
|
||||||
|
import com.nimbusds.jose.jwk.RSAKey;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.security.KeyPair;
|
||||||
|
import java.security.Principal;
|
||||||
|
import java.security.interfaces.RSAPublicKey;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
public class JwkSetEndpointConfiguration {
|
||||||
|
KeyPair keyPair;
|
||||||
|
|
||||||
|
public JwkSetEndpointConfiguration(KeyPair keyPair) {
|
||||||
|
this.keyPair = keyPair;
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/.well-known/jwks.json")
|
||||||
|
@ResponseBody
|
||||||
|
public Map<String, Object> getKey(Principal principal) {
|
||||||
|
RSAPublicKey publicKey = (RSAPublicKey) this.keyPair.getPublic();
|
||||||
|
RSAKey key = new RSAKey.Builder(publicKey).build();
|
||||||
|
return new JWKSet(key).toJSONObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,21 +59,6 @@ public class OAuth2AuthorizationServerConfig extends AuthorizationServerConfigur
|
|||||||
@Autowired
|
@Autowired
|
||||||
private Environment env;
|
private Environment env;
|
||||||
|
|
||||||
/**
|
|
||||||
* DB 설정을 별도로 하게 되면 에러가 발생한다.
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
// @Bean
|
|
||||||
// public DataSource oauthDataSource() {
|
|
||||||
//
|
|
||||||
// DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
|
||||||
// dataSource.setDriverClassName(env.getProperty("spring.datasource.driverClassName"));
|
|
||||||
// dataSource.setUrl(env.getProperty("spring.datasource.url"));
|
|
||||||
// dataSource.setUsername(env.getProperty("spring.datasource.username"));
|
|
||||||
// dataSource.setPassword(env.getProperty("spring.datasource.password"));
|
|
||||||
// return dataSource;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
|
public void configure(AuthorizationServerSecurityConfigurer security) throws Exception {
|
||||||
security.accessDeniedHandler((request, response, exception)->{
|
security.accessDeniedHandler((request, response, exception)->{
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter{
|
|||||||
.antMatchers("/js/**")
|
.antMatchers("/js/**")
|
||||||
.antMatchers("/favicon*/**")
|
.antMatchers("/favicon*/**")
|
||||||
.antMatchers("/img/**")
|
.antMatchers("/img/**")
|
||||||
|
.antMatchers("/.well-known/jwks.json")
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import lombok.Setter;
|
|||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = "users")
|
@Table(name = "users_table")
|
||||||
public class User implements UserDetails{
|
public class User implements UserDetails{
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|||||||
@@ -6,14 +6,7 @@ spring:
|
|||||||
ddl-auto: update
|
ddl-auto: update
|
||||||
properties:
|
properties:
|
||||||
hibernate:
|
hibernate:
|
||||||
dialect: org.hibernate.dialect.MySQL57Dialect
|
|
||||||
show_sql: true
|
show_sql: true
|
||||||
# datasource:
|
|
||||||
# url: jdbc:mysql://104.198.86.212:3306/uengine
|
|
||||||
# username: root
|
|
||||||
# password: test1234!@
|
|
||||||
# # mybatis 설정시에는 driverClassName 을 넣어주어야함
|
|
||||||
# driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
|
|
||||||
---
|
---
|
||||||
spring:
|
spring:
|
||||||
|
|||||||
Reference in New Issue
Block a user