-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:oauth2 增加密码模式 #10663 #10703
Merged
Merged
feat:oauth2 增加密码模式 #10663 #10703
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
205cbc1
feat:oauth2 增加密码模式 #10663
fcfang123 805db25
feat:oauth2 增加密码模式 #10663
fcfang123 9f80edf
feat:oauth2 增加密码模式 #10663
fcfang123 c8e48a3
feat:oauth2 增加密码模式 #10663
fcfang123 6f4caec
feat:oauth2 增加密码模式 #10663
fcfang123 8ce080d
feat:oauth2 增加密码模式 #10663
fcfang123 28fb1b4
Merge branch 'master' into issue-10663
fcfang123 06a3dd3
feat:oauth2 增加密码模式 #10663
fcfang123 b65c4f7
feat:oauth2 增加密码模式 #10663
fcfang123 5b6b4f5
feat:oauth2 增加密码模式 #10663
fcfang123 1bdc23c
feat:oauth2 增加密码模式 #10663
fcfang123 a9894b9
feat:oauth2 增加密码模式 #10663
fcfang123 aefcb65
feat:oauth2 增加密码模式 #10663
fcfang123 970b815
feat:oauth2 增加密码模式 #10663
fcfang123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
25 changes: 18 additions & 7 deletions
25
...re/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/pojo/Oauth2AccessTokenRequest.kt
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 |
---|---|---|
@@ -1,13 +1,24 @@ | ||
package com.tencent.devops.auth.pojo | ||
|
||
import com.fasterxml.jackson.annotation.JsonSubTypes | ||
import com.fasterxml.jackson.annotation.JsonTypeInfo | ||
import com.tencent.devops.auth.pojo.enum.Oauth2GrantType | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "oauth2获取token请求报文体") | ||
data class Oauth2AccessTokenRequest( | ||
@get:Schema(title = "授权类型", required = true) | ||
val grantType: String, | ||
@get:Schema(title = "授权码,用于授权码模式", required = false) | ||
val code: String? = null, | ||
@get:Schema(title = "refreshToken,用于刷新授权码模式", required = false) | ||
val refreshToken: String? = null | ||
@JsonTypeInfo( | ||
use = JsonTypeInfo.Id.NAME, | ||
include = JsonTypeInfo.As.EXISTING_PROPERTY, | ||
property = "grantType", | ||
visible = true, | ||
defaultImpl = Oauth2AccessTokenRequest::class | ||
) | ||
@JsonSubTypes( | ||
JsonSubTypes.Type(value = Oauth2AuthorizationCodeRequest::class, name = Oauth2AuthorizationCodeRequest.TYPE), | ||
JsonSubTypes.Type(value = Oauth2PassWordRequest::class, name = Oauth2PassWordRequest.TYPE), | ||
JsonSubTypes.Type(value = Oauth2RefreshTokenRequest::class, name = Oauth2RefreshTokenRequest.TYPE) | ||
) | ||
interface Oauth2AccessTokenRequest { | ||
@get:Schema(title = "授权类型", required = true) | ||
open val grantType: Oauth2GrantType | ||
} |
16 changes: 16 additions & 0 deletions
16
...h/api-auth/src/main/kotlin/com/tencent/devops/auth/pojo/Oauth2AuthorizationCodeRequest.kt
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 @@ | ||
package com.tencent.devops.auth.pojo | ||
|
||
import com.tencent.devops.auth.pojo.enum.Oauth2GrantType | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "授权码模式获取token请求报文体") | ||
data class Oauth2AuthorizationCodeRequest( | ||
@get:Schema(title = "授权类型", required = true) | ||
override val grantType: Oauth2GrantType, | ||
@get:Schema(title = "授权码,用于授权码模式", required = false) | ||
val code: String | ||
) : Oauth2AccessTokenRequest { | ||
companion object { | ||
const val TYPE = "AUTHORIZATION_CODE" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
.../core/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/pojo/Oauth2PassWordRequest.kt
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.tencent.devops.auth.pojo | ||
|
||
import com.tencent.devops.auth.pojo.enum.Oauth2GrantType | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "密码模式获取token请求报文体") | ||
data class Oauth2PassWordRequest( | ||
@get:Schema(title = "授权类型", required = true) | ||
override val grantType: Oauth2GrantType, | ||
@get:Schema(title = "账号名称,用于密码模式", required = false) | ||
val userName: String? = null, | ||
@get:Schema(title = "密码,用于密码模式", required = false) | ||
val passWord: String? = null | ||
) : Oauth2AccessTokenRequest { | ||
companion object { | ||
const val TYPE = "PASS_WORD" | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
...e/auth/api-auth/src/main/kotlin/com/tencent/devops/auth/pojo/Oauth2RefreshTokenRequest.kt
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 @@ | ||
package com.tencent.devops.auth.pojo | ||
|
||
import com.tencent.devops.auth.pojo.enum.Oauth2GrantType | ||
import io.swagger.v3.oas.annotations.media.Schema | ||
|
||
@Schema(title = "客户端模式获取token请求报文体") | ||
data class Oauth2RefreshTokenRequest( | ||
@get:Schema(title = "授权类型", required = true) | ||
override val grantType: Oauth2GrantType, | ||
@get:Schema(title = "刷新码,用于刷新授权码模式", required = false) | ||
val refreshToken: String | ||
) : Oauth2AccessTokenRequest { | ||
companion object { | ||
const val TYPE = "REFRESH_TOKEN" | ||
} | ||
} |
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
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
密码需要加密存储