-
Notifications
You must be signed in to change notification settings - Fork 67
feat: add service account support #152
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
Open
lajohn4747
wants to merge
17
commits into
master
Choose a base branch
from
johnla-multi-567-add-service-account-support-to-ruby-sdk
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+388
−27
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e70855a
Add service account support
lajohn4747 6ac0e4c
Fix comments
lajohn4747 7269367
Add explicit to_json method to ServiceAccountCredentials
lajohn4747 f3dc6da
Simplify credentials API for feature flags
lajohn4747 f7f4269
Remove credentials from config hash, pass as separate parameter
lajohn4747 03a0096
Fix flag provider tests for new credentials parameter
lajohn4747 2d12649
Fix remaining provider instantiation in polling test
lajohn4747 b520a0b
Add tests for service account credentials authentication in flag prov…
lajohn4747 dca931f
Add test for service account credentials in Consumer import endpoint
lajohn4747 880a281
Fix passing credentials to go import
lajohn4747 d7a06bf
Fix WebMock stub for service account import test
lajohn4747 8183119
security: exclude secret from ServiceAccountCredentials JSON serializ…
lajohn4747 9c5be70
test: update tests to expect secret not in JSON serialization
lajohn4747 3336b0e
fix: accept integer project_id and convert to string
lajohn4747 0e1377f
fix test
lajohn4747 9d57d4a
Merge branch 'master' into johnla-multi-567-add-service-account-suppo…
lajohn4747 9f9ef92
Fix tests after rebase
lajohn4747 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,40 @@ | ||
| module Mixpanel | ||
| # Service account credentials for server-to-server authentication | ||
| # This is the recommended authentication method over API keys | ||
| class ServiceAccountCredentials | ||
| attr_reader :username, :secret, :project_id | ||
|
|
||
| # Create service account credentials | ||
| # @param username [String] Service account username | ||
| # @param secret [String] Service account secret | ||
| # @param project_id [String, Integer] Mixpanel project ID (accepts string or integer) | ||
| def initialize(username, secret, project_id) | ||
| raise ArgumentError, 'username is required' if username.nil? || username.empty? | ||
| raise ArgumentError, 'secret is required' if secret.nil? || secret.empty? | ||
| raise ArgumentError, 'project_id is required' if project_id.nil? | ||
|
|
||
| # Convert project_id to string if it's an integer (Mixpanel dashboard shows numeric IDs) | ||
| project_id = project_id.to_s if project_id.is_a?(Integer) | ||
| raise ArgumentError, 'project_id is required' if project_id.empty? | ||
|
|
||
| @username = username | ||
| @secret = secret | ||
| @project_id = project_id | ||
| end | ||
|
|
||
| # JSON serialization support - called automatically by JSON.generate/to_json | ||
| # Note: secret IS included because it's needed by the Consumer for HTTP Basic Auth | ||
| def as_json(options = nil) | ||
| { | ||
| 'username' => @username, | ||
| 'secret' => @secret, | ||
| 'project_id' => @project_id | ||
| } | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
| end | ||
|
greptile-apps[bot] marked this conversation as resolved.
|
||
|
|
||
| # Explicit to_json method for direct .to_json calls | ||
| def to_json(*args) | ||
| as_json.to_json(*args) | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.