Skip to content
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

Fix JSR310 serialization error when preparing login panel #5216

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type" : "bugfix",
"description" : "Fix issue where users are unable to login to Amazon Q if they have previously authenticated (#5214)"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package software.aws.toolkits.jetbrains.core.credentials

import com.fasterxml.jackson.annotation.JsonIgnore
import com.intellij.openapi.Disposable
import com.intellij.openapi.util.Disposer
import software.aws.toolkits.core.TokenConnectionSettings
Expand Down Expand Up @@ -73,6 +74,7 @@ sealed class ManagedBearerSsoConnection(
region
)

@JsonIgnore
override fun getConnectionSettings(): TokenConnectionSettings = provider

override fun dispose() {
Expand All @@ -99,6 +101,7 @@ class DetectedDiskSsoSessionConnection(
region
)

@JsonIgnore
override fun getConnectionSettings(): TokenConnectionSettings = provider

override fun dispose() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package software.aws.toolkits.jetbrains.core.credentials

import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
import com.intellij.testFramework.ProjectExtension
Expand Down Expand Up @@ -453,6 +454,22 @@ class DefaultToolkitAuthManagerTest {
}
}

@Test
fun `serializing LegacyManagedBearerSsoConnection does not include connectionSettings`() {
val profile = ManagedSsoProfile("us-east-1", "startUrl000", listOf("scopes"))
val connection = sut.createConnection(profile) as LegacyManagedBearerSsoConnection

assertThat(jacksonObjectMapper().writeValueAsString(connection)).doesNotContain("connectionSettings")
}

@Test
fun `serializing ProfileSsoManagedBearerSsoConnection does not include connectionSettings`() {
val profile = UserConfigSsoSessionProfile("sessionName", "us-east-1", "startUrl000", listOf("scopes"))
val connection = sut.createConnection(profile) as ProfileSsoManagedBearerSsoConnection

assertThat(jacksonObjectMapper().writeValueAsString(connection)).doesNotContain("connectionSettings")
}

private companion object {
@ExtendWith(ProjectExtension::class)
val projectRule = ProjectRule()
Expand Down
Loading