Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
alvachien
spring-auth-server-demo
提交
592804fc
S
spring-auth-server-demo
项目概览
alvachien
/
spring-auth-server-demo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-auth-server-demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
592804fc
编写于
12月 04, 2022
作者:
alvachien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the auth. server works
上级
20f553aa
变更
11
隐藏空白更改
内联
并排
Showing
11 changed file
with
128 addition
and
85 deletion
+128
-85
auth-server-demo/pom.xml
auth-server-demo/pom.xml
+7
-0
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/AuthServerDemoApplication.java
...c/alvachien/authserverdemo/AuthServerDemoApplication.java
+50
-1
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/component/JpaRegisteredClientRepository.java
...thserverdemo/component/JpaRegisteredClientRepository.java
+4
-0
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/config/SecurityConfig.java
...m/poc/alvachien/authserverdemo/config/SecurityConfig.java
+9
-44
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/Authorization.java
...com/poc/alvachien/authserverdemo/model/Authorization.java
+18
-13
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/AuthorizationConsent.java
.../alvachien/authserverdemo/model/AuthorizationConsent.java
+3
-1
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/Client.java
...n/java/com/poc/alvachien/authserverdemo/model/Client.java
+10
-6
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/UserAccount.java
...a/com/poc/alvachien/authserverdemo/model/UserAccount.java
+8
-2
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/UserRole.java
...java/com/poc/alvachien/authserverdemo/model/UserRole.java
+10
-12
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/service/MyUserDetailsService.java
...lvachien/authserverdemo/service/MyUserDetailsService.java
+8
-5
auth-server-demo/src/main/resources/application.properties
auth-server-demo/src/main/resources/application.properties
+1
-1
未找到文件。
auth-server-demo/pom.xml
浏览文件 @
592804fc
...
...
@@ -17,6 +17,12 @@
<java.version>
17
</java.version>
</properties>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-actuator
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
...
...
@@ -38,6 +44,7 @@
<groupId>
com.microsoft.sqlserver
</groupId>
<artifactId>
mssql-jdbc
</artifactId>
<version>
11.2.1.jre17
</version>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/AuthServerDemoApplication.java
浏览文件 @
592804fc
...
...
@@ -3,9 +3,18 @@ package com.poc.alvachien.authserverdemo;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.security.oauth2.core.AuthorizationGrantType
;
import
org.springframework.security.oauth2.core.ClientAuthenticationMethod
;
import
org.springframework.security.oauth2.core.oidc.OidcScopes
;
import
org.springframework.security.oauth2.server.authorization.client.RegisteredClient
;
import
org.springframework.security.oauth2.server.authorization.settings.ClientSettings
;
import
com.poc.alvachien.authserverdemo.component.JpaRegisteredClientRepository
;
import
com.poc.alvachien.authserverdemo.model.UserAccount
;
import
com.poc.alvachien.authserverdemo.repository.UserAccountRepository
;
import
java.util.UUID
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.boot.CommandLineRunner
;
...
...
@@ -19,8 +28,48 @@ public class AuthServerDemoApplication {
}
@Bean
public
CommandLineRunner
demo
(
UserAccountRepository
r
epository
)
{
public
CommandLineRunner
preparetestdata
(
UserAccountRepository
userRepository
,
JpaRegisteredClientRepository
clientR
epository
)
{
return
(
args
)
->
{
log
.
info
(
"Entering CommandLineRunner"
);
Long
userCnt
=
userRepository
.
count
();
log
.
info
(
"User Count = "
+
userCnt
);
if
(
userCnt
==
0
)
{
UserAccount
ua
=
new
UserAccount
();
ua
.
setUsername
(
"test"
);
ua
.
setPassword
(
"test"
);
ua
.
setActive
(
true
);
userRepository
.
save
(
ua
);
log
.
info
(
"Test User 'test' created"
);
}
userCnt
=
userRepository
.
count
();
log
.
info
(
"User Count = "
+
userCnt
);
Long
clientCnt
=
clientRepository
.
count
();
log
.
info
(
"Client Count = "
+
userCnt
);
if
(
clientCnt
==
0
)
{
RegisteredClient
client
=
RegisteredClient
.
withId
(
UUID
.
randomUUID
().
toString
())
.
clientId
(
"angular-client"
)
.
clientSecret
(
"{noop}secret"
)
.
clientAuthenticationMethod
(
ClientAuthenticationMethod
.
CLIENT_SECRET_BASIC
)
.
authorizationGrantType
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
)
.
authorizationGrantType
(
AuthorizationGrantType
.
REFRESH_TOKEN
)
.
authorizationGrantType
(
AuthorizationGrantType
.
CLIENT_CREDENTIALS
)
.
redirectUri
(
"http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc"
)
.
redirectUri
(
"http://127.0.0.1:8080/authorized"
)
.
scope
(
OidcScopes
.
OPENID
)
.
scope
(
OidcScopes
.
PROFILE
)
.
scope
(
"message.read"
)
.
scope
(
"message.write"
)
.
clientSettings
(
ClientSettings
.
builder
().
requireAuthorizationConsent
(
true
).
build
())
.
build
();
clientRepository
.
save
(
client
);
log
.
info
(
"Test Client 'angular-client' created"
);
}
clientCnt
=
clientRepository
.
count
();
log
.
info
(
"Client Count = "
+
userCnt
);
// // save a few customers
// repository.save(new Customer("Jack", "Bauer"));
// repository.save(new Customer("Chloe", "O'Brian"));
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/component/JpaRegisteredClientRepository.java
浏览文件 @
592804fc
...
...
@@ -154,4 +154,8 @@ public class JpaRegisteredClientRepository implements RegisteredClientRepository
}
return
new
ClientAuthenticationMethod
(
clientAuthenticationMethod
);
// Custom client authentication method
}
public
Long
count
()
{
return
this
.
clientRepository
.
count
();
}
}
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/config/SecurityConfig.java
浏览文件 @
592804fc
...
...
@@ -15,7 +15,6 @@ import com.nimbusds.jose.jwk.source.JWKSource;
import
com.nimbusds.jose.proc.SecurityContext
;
import
com.poc.alvachien.authserverdemo.service.MyUserDetailsService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.annotation.Order
;
...
...
@@ -24,28 +23,16 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import
org.springframework.security.config.annotation.web.configurers.oauth2.server.resource.OAuth2ResourceServerConfigurer
;
import
org.springframework.security.core.Authentication
;
import
org.springframework.security.core.GrantedAuthority
;
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.crypto.factory.PasswordEncoderFactories
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.oauth2.core.AuthorizationGrantType
;
import
org.springframework.security.oauth2.core.ClientAuthenticationMethod
;
import
org.springframework.security.oauth2.core.oidc.OidcScopes
;
import
org.springframework.security.oauth2.core.oidc.OidcUserInfo
;
import
org.springframework.security.oauth2.core.oidc.endpoint.OidcParameterNames
;
import
org.springframework.security.oauth2.jwt.JwtDecoder
;
import
org.springframework.security.oauth2.server.authorization.OAuth2TokenType
;
import
org.springframework.security.oauth2.server.authorization.client.InMemoryRegisteredClientRepository
;
import
org.springframework.security.oauth2.server.authorization.client.RegisteredClient
;
import
org.springframework.security.oauth2.server.authorization.client.RegisteredClientRepository
;
import
org.springframework.security.oauth2.server.authorization.config.annotation.web.configuration.OAuth2AuthorizationServerConfiguration
;
import
org.springframework.security.oauth2.server.authorization.config.annotation.web.configurers.OAuth2AuthorizationServerConfigurer
;
import
org.springframework.security.oauth2.server.authorization.settings.AuthorizationServerSettings
;
import
org.springframework.security.oauth2.server.authorization.settings.ClientSettings
;
import
org.springframework.security.oauth2.server.authorization.token.JwtEncodingContext
;
import
org.springframework.security.oauth2.server.authorization.token.OAuth2TokenCustomizer
;
import
org.springframework.security.provisioning.InMemoryUserDetailsManager
;
import
org.springframework.security.web.SecurityFilterChain
;
import
org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint
;
...
...
@@ -133,38 +120,17 @@ public class SecurityConfig {
};
}
@Bean
public
UserDetailsService
userDetailsService
()
{
PasswordEncoder
encoder
=
PasswordEncoderFactories
.
createDelegatingPasswordEncoder
();
//
@Bean
//
public UserDetailsService userDetailsService() {
//
PasswordEncoder encoder = PasswordEncoderFactories.createDelegatingPasswordEncoder();
UserDetails
userDetails
=
User
.
withUsername
(
"user"
)
.
password
(
encoder
.
encode
(
"password"
))
.
roles
(
"USER"
)
.
build
();
//
UserDetails userDetails = User.withUsername("user")
//
.password(encoder.encode("password"))
//
.roles("USER")
//
.build();
return
new
InMemoryUserDetailsManager
(
userDetails
);
}
@Bean
public
RegisteredClientRepository
registeredClientRepository
()
{
RegisteredClient
registeredClient
=
RegisteredClient
.
withId
(
UUID
.
randomUUID
().
toString
())
.
clientId
(
"messaging-client"
)
.
clientSecret
(
"{noop}secret"
)
.
clientAuthenticationMethod
(
ClientAuthenticationMethod
.
CLIENT_SECRET_BASIC
)
.
authorizationGrantType
(
AuthorizationGrantType
.
AUTHORIZATION_CODE
)
.
authorizationGrantType
(
AuthorizationGrantType
.
REFRESH_TOKEN
)
.
authorizationGrantType
(
AuthorizationGrantType
.
CLIENT_CREDENTIALS
)
.
redirectUri
(
"http://127.0.0.1:8080/login/oauth2/code/messaging-client-oidc"
)
.
redirectUri
(
"http://127.0.0.1:8080/authorized"
)
.
scope
(
OidcScopes
.
OPENID
)
.
scope
(
OidcScopes
.
PROFILE
)
.
scope
(
"message.read"
)
.
scope
(
"message.write"
)
.
clientSettings
(
ClientSettings
.
builder
().
requireAuthorizationConsent
(
true
).
build
())
.
build
();
return
new
InMemoryRegisteredClientRepository
(
registeredClient
);
}
// return new InMemoryUserDetailsManager(userDetails);
// }
@Bean
public
JWKSource
<
SecurityContext
>
jwkSource
()
{
...
...
@@ -201,5 +167,4 @@ public class SecurityConfig {
public
AuthorizationServerSettings
authorizationServerSettings
()
{
return
AuthorizationServerSettings
.
builder
().
build
();
}
}
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/Authorization.java
浏览文件 @
592804fc
...
...
@@ -8,51 +8,56 @@ import jakarta.persistence.Id;
import
jakarta.persistence.Table
;
@Entity
@Table
(
name
=
"
authorization
"
)
@Table
(
name
=
"
[authorization]
"
)
public
class
Authorization
{
@Id
@Column
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
id
;
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
registeredClientId
;
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
principalName
;
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
authorizationGrantType
;
@Column
(
length
=
1000
)
private
String
authorizedScopes
;
@Column
(
length
=
4000
)
@Column
(
length
=
4000
,
columnDefinition
=
"nvarchar(4000)"
)
private
String
attributes
;
@Column
(
length
=
500
)
@Column
(
length
=
500
,
columnDefinition
=
"nvarchar(500)"
)
private
String
state
;
@Column
(
length
=
4000
)
@Column
(
length
=
4000
,
columnDefinition
=
"nvarchar(4000)"
)
private
String
authorizationCodeValue
;
private
Instant
authorizationCodeIssuedAt
;
private
Instant
authorizationCodeExpiresAt
;
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
authorizationCodeMetadata
;
@Column
(
length
=
4000
)
@Column
(
length
=
4000
,
columnDefinition
=
"nvarchar(4000)"
)
private
String
accessTokenValue
;
private
Instant
accessTokenIssuedAt
;
private
Instant
accessTokenExpiresAt
;
@Column
(
length
=
2000
)
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
accessTokenMetadata
;
@Column
(
length
=
255
,
columnDefinition
=
"nvarchar(255)"
)
private
String
accessTokenType
;
@Column
(
length
=
1000
)
@Column
(
length
=
1000
,
columnDefinition
=
"nvarchar(1000)"
)
private
String
accessTokenScopes
;
@Column
(
length
=
4000
)
@Column
(
length
=
4000
,
columnDefinition
=
"nvarchar(4000)"
)
private
String
refreshTokenValue
;
private
Instant
refreshTokenIssuedAt
;
private
Instant
refreshTokenExpiresAt
;
@Column
(
length
=
2000
)
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
refreshTokenMetadata
;
@Column
(
length
=
4000
)
@Column
(
length
=
4000
,
columnDefinition
=
"nvarchar(4000)"
)
private
String
oidcIdTokenValue
;
private
Instant
oidcIdTokenIssuedAt
;
private
Instant
oidcIdTokenExpiresAt
;
@Column
(
length
=
2000
)
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
oidcIdTokenMetadata
;
@Column
(
length
=
2000
)
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
oidcIdTokenClaims
;
public
String
getId
()
{
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/AuthorizationConsent.java
浏览文件 @
592804fc
...
...
@@ -14,10 +14,12 @@ import jakarta.persistence.Table;
@IdClass
(
AuthorizationConsent
.
AuthorizationConsentId
.
class
)
public
class
AuthorizationConsent
{
@Id
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
registeredClientId
;
@Id
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
principalName
;
@Column
(
length
=
1000
)
@Column
(
length
=
1000
,
nullable
=
false
,
columnDefinition
=
"nvarchar(1000)"
)
private
String
authorities
;
public
String
getRegisteredClientId
()
{
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/Client.java
浏览文件 @
592804fc
...
...
@@ -11,23 +11,27 @@ import jakarta.persistence.Table;
@Table
(
name
=
"client"
)
public
class
Client
{
@Id
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
id
;
@Column
(
length
=
255
,
nullable
=
false
,
columnDefinition
=
"nvarchar(255)"
)
private
String
clientId
;
private
Instant
clientIdIssuedAt
;
@Column
(
length
=
255
,
columnDefinition
=
"nvarchar(255)"
)
private
String
clientSecret
;
private
Instant
clientSecretExpiresAt
;
@Column
(
length
=
255
,
columnDefinition
=
"nvarchar(255)"
)
private
String
clientName
;
@Column
(
length
=
1000
)
@Column
(
length
=
1000
,
columnDefinition
=
"nvarchar(1000)"
)
private
String
clientAuthenticationMethods
;
@Column
(
length
=
1000
)
@Column
(
length
=
1000
,
columnDefinition
=
"nvarchar(1000)"
)
private
String
authorizationGrantTypes
;
@Column
(
length
=
1000
)
@Column
(
length
=
1000
,
columnDefinition
=
"nvarchar(1000)"
)
private
String
redirectUris
;
@Column
(
length
=
1000
)
@Column
(
length
=
1000
,
columnDefinition
=
"nvarchar(1000)"
)
private
String
scopes
;
@Column
(
length
=
2000
)
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
clientSettings
;
@Column
(
length
=
2000
)
@Column
(
length
=
2000
,
columnDefinition
=
"nvarchar(2000)"
)
private
String
tokenSettings
;
public
String
getId
()
{
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/UserAccount.java
浏览文件 @
592804fc
...
...
@@ -2,28 +2,34 @@ package com.poc.alvachien.authserverdemo.model;
import
java.util.List
;
import
jakarta.persistence.CascadeType
;
import
jakarta.persistence.Column
;
import
jakarta.persistence.Entity
;
import
jakarta.persistence.FetchType
;
import
jakarta.persistence.GeneratedValue
;
import
jakarta.persistence.GenerationType
;
import
jakarta.persistence.Id
;
import
jakarta.persistence.OneToMany
;
import
jakarta.persistence.Table
;
@Entity
@Table
(
name
=
"useraccount"
)
public
class
UserAccount
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
private
Long
id
;
@Column
(
nullable
=
false
,
unique
=
true
)
@Column
(
nullable
=
false
,
unique
=
true
,
length
=
50
,
columnDefinition
=
"nvarchar(50)"
)
private
String
username
;
@Column
(
nullable
=
false
,
length
=
50
,
columnDefinition
=
"nvarchar(50)"
)
private
String
password
;
@Column
(
nullable
=
false
)
private
boolean
active
;
@OneToMany
@OneToMany
(
mappedBy
=
"userAccount"
,
fetch
=
FetchType
.
LAZY
,
cascade
=
CascadeType
.
ALL
)
private
List
<
UserRole
>
userRoles
;
public
UserAccount
()
{
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/model/UserRole.java
浏览文件 @
592804fc
...
...
@@ -2,22 +2,28 @@ package com.poc.alvachien.authserverdemo.model;
import
jakarta.persistence.Column
;
import
jakarta.persistence.Entity
;
import
jakarta.persistence.FetchType
;
import
jakarta.persistence.GeneratedValue
;
import
jakarta.persistence.GenerationType
;
import
jakarta.persistence.Id
;
import
jakarta.persistence.JoinColumn
;
import
jakarta.persistence.ManyToOne
;
import
jakarta.persistence.Table
;
import
org.springframework.security.core.GrantedAuthority
;
@Entity
@Table
(
name
=
"userrole"
)
public
class
UserRole
implements
GrantedAuthority
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
private
Integer
id
;
@GeneratedValue
(
strategy
=
GenerationType
.
AUTO
)
private
Long
id
;
@Column
(
nullable
=
false
,
unique
=
true
)
@Column
(
nullable
=
false
,
length
=
50
)
private
String
name
;
@ManyToOne
@ManyToOne
(
fetch
=
FetchType
.
LAZY
,
optional
=
false
)
@JoinColumn
(
name
=
"useraccount_id"
,
nullable
=
false
)
private
UserAccount
userAccount
;
public
UserRole
()
{
...
...
@@ -27,14 +33,6 @@ public class UserRole implements GrantedAuthority {
this
.
name
=
name
;
}
public
Integer
getId
()
{
return
id
;
}
public
void
setId
(
Integer
id
)
{
this
.
id
=
id
;
}
public
String
getName
()
{
return
name
;
}
...
...
auth-server-demo/src/main/java/com/poc/alvachien/authserverdemo/service/MyUserDetailsService.java
浏览文件 @
592804fc
package
com.poc.alvachien.authserverdemo.service
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.core.userdetails.UserDetails
;
import
org.springframework.security.core.userdetails.UserDetailsService
;
import
org.springframework.stereotype.Service
;
...
...
@@ -10,11 +9,13 @@ import com.poc.alvachien.authserverdemo.model.MyUserDetails;
import
com.poc.alvachien.authserverdemo.model.UserAccount
;
import
com.poc.alvachien.authserverdemo.repository.UserAccountRepository
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
@Service
public
class
MyUserDetailsService
implements
UserDetailsService
{
private
final
UserAccountRepository
userAccountRepository
;
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
MyUserDetailsService
.
class
);
private
final
UserAccountRepository
userAccountRepository
;
public
MyUserDetailsService
(
UserAccountRepository
userAccountRepository
)
{
this
.
userAccountRepository
=
userAccountRepository
;
...
...
@@ -22,9 +23,11 @@ public class MyUserDetailsService implements UserDetailsService {
@Override
public
UserDetails
loadUserByUsername
(
String
username
)
{
log
.
info
(
"loadUserByUsername: "
+
username
);
UserAccount
userAccount
=
userAccountRepository
.
findByUsername
(
username
);
if
(
userAccount
==
null
)
{
try
{
log
.
error
(
"User with username ["
+
username
+
"] not found in the system"
);
try
{
throw
new
UsernameNotFoundException
(
"User with username ["
+
username
+
"] not found in the system"
);
}
catch
(
UsernameNotFoundException
e
)
{
// TODO Auto-generated catch block
...
...
auth-server-demo/src/main/resources/application.properties
浏览文件 @
592804fc
server.port
:
9600
spring.jpa.hibernate.ddl-auto
=
update
spring.datasource.url
=
jdbc:sqlserver://localhost;
database=authserver;integratedSecurity=true;encrypt
=true;trustServerCertificate=true
spring.datasource.url
=
jdbc:sqlserver://localhost;
encrypt=true;database=authdemo;integratedSecurity
=true;trustServerCertificate=true
#spring.datasource.username=springuser
#spring.datasource.password=ThePassword
spring.datasource.driver-class-name
=
com.microsoft.sqlserver.jdbc.SQLServerDriver
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录