File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
tang-framework/src/main/kotlin/com/tang/framework/utils Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 7
7
* Case order by format from lower hyphen to upper underscore
8
8
* Fix mybatis flex order query error
9
9
* Fix ` Spring Boot Admin ` 401 error
10
+ * Fix authentication failure
10
11
11
12
### Optimization
12
13
Original file line number Diff line number Diff line change 1
1
package com.tang.framework.utils
2
2
3
3
import org.springframework.security.authentication.AbstractAuthenticationToken
4
+ import org.springframework.security.core.GrantedAuthority
4
5
5
6
import com.tang.commons.enumeration.LoginType
6
7
import com.tang.framework.security.authentication.email.EmailAuthenticationToken
@@ -13,11 +14,11 @@ import com.tang.framework.security.authentication.username.UsernameAuthenticatio
13
14
object AuthenticationUtils {
14
15
15
16
@JvmStatic
16
- fun newInstance (loginType : String , vararg params : Any ): AbstractAuthenticationToken {
17
+ fun newInstance (loginType : String , principal : Any , authorities : Collection < GrantedAuthority > ): AbstractAuthenticationToken {
17
18
return when (LoginType .getLoginType(loginType)) {
18
- LoginType .USERNAME -> UsernameAuthenticationToken (params[ 0 ], params[ 1 ] )
19
- LoginType .EMAIL -> EmailAuthenticationToken (params[ 0 ], params[ 1 ] )
20
- LoginType .GITHUB -> GitHubAuthenticationToken (params[ 0 ] )
19
+ LoginType .USERNAME -> UsernameAuthenticationToken (principal, authorities )
20
+ LoginType .EMAIL -> EmailAuthenticationToken (principal, authorities )
21
+ LoginType .GITHUB -> GitHubAuthenticationToken (principal )
21
22
else -> throw IllegalArgumentException (" Unexpected login type: $loginType " )
22
23
}
23
24
}
You can’t perform that action at this time.
0 commit comments