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

Add Support for Nested Metadata Configuration in OAuth2 Client Using JSON Format #21

Merged
merged 14 commits into from
Sep 26, 2024

Conversation

YevheniiSemenko
Copy link
Contributor

This update introduces the ability to configure the metadata field in OAuth2 clients using the metadata_json parameter, allowing for nested key-value structures.

The current implementation only supported flat key-value pairs, which limited use cases requiring more complex metadata. With the new approach, users can specify nested metadata by providing it in JSON format.

The change is backward-compatible, ensuring that existing users relying on the metadata field without JSON can continue without disruption. Both terraform apply and terraform import handle the new format seamlessly.

During terraform import, the provider detects nested metadata and stores it in metadata_json if needed, while simple structures remain in metadata.

Example of usage:

resource "hydra_oauth2_client" "client_with_metadata_json" {
	client_name = "client_with_metadata_json"
	metadata_json = jsonencode({
		"nested" = {
			"key" = "value"
		},
		"first_party" = true
	})
	redirect_uris = ["http://localhost:8080/callback"]
	response_types = ["code"]
	token_endpoint_auth_method = "none"
}

Aneliya Ivanova and others added 12 commits September 4, 2024 15:20
…JSON Format

* add metada_json to configure nested metadata parameters

* enhance terraform import logic for metadata parameter, fix string unconvertible issue

* add acc test for client configuration with metadata_json parameter

* update doc with metadata_json parameter

* switch docker compose to v2

---------

Co-authored-by: Aneliya Ivanova <[email protected]>
@YevheniiSemenko
Copy link
Contributor Author

I tweaked the GitHub Actions a bit since some things were recently deprecated, causing the test and release pipelines to fail.

Also, I hope you won’t be offended, but I registered my fork in the Terraform registry. We're using Atlantis to manage Terraform configurations, and having a custom provider means we would need to release a custom Atlantis image. For a secure environment, that’s a lot of hassle and requires much more effort. Once the PR is merged, I'll request the deletion of the fork. Thank you for understanding!

Copy link
Owner

@svrakitin svrakitin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the contribution.

I'm happy with people forking stuff, I don't have much time to dedicate to this provider as I'm not using Hydra currently. :)

@svrakitin svrakitin merged commit 946891b into svrakitin:main Sep 26, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants