Skip to content

Commit

Permalink
feat:蓝盾APP Oauth2授权登录实现 #9353
Browse files Browse the repository at this point in the history
  • Loading branch information
fcfang123 committed Nov 15, 2023
1 parent 6b90a7b commit 8b494cc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.tencent.devops.auth.service.oauth2

import com.tencent.devops.auth.pojo.ClientDetailsInfo
import com.tencent.devops.auth.pojo.Oauth2AccessTokenRequest
import com.tencent.devops.auth.service.oauth2.grant.AuthorizationCodeTokenGranter
import com.tencent.devops.common.test.BkCiAbstractTest
import com.tencent.devops.model.auth.tables.records.TAuthOauth2AccessTokenRecord
import com.tencent.devops.model.auth.tables.records.TAuthOauth2RefreshTokenRecord
import io.mockk.every
import io.mockk.junit5.MockKExtension
import io.mockk.mockk
Expand Down Expand Up @@ -41,7 +39,8 @@ class AuthorizationCodeTokenGranterTest : BkCiAbstractTest() {
redirectUri = "testRedirectUri",
scope = "testScope",
accessTokenValidity = 3600,
refreshTokenValidity = 3600
refreshTokenValidity = 3600,
icon = "icon"
)

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class Oauth2ClientServiceTest : BkCiAbstractTest() {
authorizedGrantTypes = "authorization_code,refresh_token",
redirectUri = "http://example.com/callback",
accessTokenValidity = 3600,
refreshTokenValidity = 86400
refreshTokenValidity = 86400,
icon = "icon"
)

val invalidGrantType = "invalid_grant_type"
Expand Down Expand Up @@ -58,7 +59,8 @@ class Oauth2ClientServiceTest : BkCiAbstractTest() {
authorizedGrantTypes = "authorization_code",
redirectUri = "http://example.com/callback",
accessTokenValidity = 3600,
refreshTokenValidity = 86400
refreshTokenValidity = 86400,
icon = "icon"
)

val invalidRedirectUri = "http://invalid.com/callback"
Expand Down Expand Up @@ -86,7 +88,8 @@ class Oauth2ClientServiceTest : BkCiAbstractTest() {
authorizedGrantTypes = "authorization_code",
redirectUri = "http://example.com/callback",
accessTokenValidity = 3600,
refreshTokenValidity = 86400
refreshTokenValidity = 86400,
icon = "icon"
)

val invalidClientSecret = "invalidSecret"
Expand Down Expand Up @@ -114,7 +117,8 @@ class Oauth2ClientServiceTest : BkCiAbstractTest() {
authorizedGrantTypes = "authorization_code",
redirectUri = "http://example.com/callback",
accessTokenValidity = 3600,
refreshTokenValidity = 86400
refreshTokenValidity = 86400,
icon = "icon"
)

val invalidScope = listOf("invalidScope")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class RefreshTokenGranterTest : BkCiAbstractTest() {
redirectUri = "testRedirectUri",
scope = "testScope",
accessTokenValidity = 3600,
refreshTokenValidity = 3600
refreshTokenValidity = 3600,
icon = "icon"
)

private val accessTokenInfo = TAuthOauth2AccessTokenRecord(
Expand Down

0 comments on commit 8b494cc

Please sign in to comment.