Skip to content

Commit

Permalink
Merge pull request #18 from phasehq/feat--add-service-account-support
Browse files Browse the repository at this point in the history
Feat: add service account support
  • Loading branch information
nimish-ks authored Oct 29, 2024
2 parents 401d5c0 + cdb7b78 commit fd82dbc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
14 changes: 7 additions & 7 deletions helm-repo/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v1
entries:
phase:
- apiVersion: v2
created: "2024-10-27T13:18:22.353245013+05:30"
created: "2024-10-29T13:20:00.665108467+05:30"
description: A Helm chart for deploying the Phase Secrets Manager
digest: 2bcc5bd5f1da6139c2c07abb001eb3ec8f60d0ea0e8dc5f754c4cc8ca7bfe9b3
home: https://github.com/phasehq/kubernetes-secrets-operator
Expand All @@ -22,10 +22,10 @@ entries:
version: 0.1.1
phase-kubernetes-operator:
- apiVersion: v2
appVersion: 1.2.2
created: "2024-10-27T13:18:22.353595366+05:30"
appVersion: 1.2.3
created: "2024-10-29T13:20:00.66538365+05:30"
description: A Helm chart for deploying the Phase Kubernetes Operator
digest: 4e9e99e4e9d2e865dba4c5036994ddee600c4bce00d8082a5e8f511235531514
digest: 93e571ad092af42648a8731de51d6b1a371f5b738a5b6c5a327ca38fa90d45e4
home: https://github.com/phasehq/kubernetes-secrets-operator
icon: https://phase.dev/apple-touch-icon.png
keywords:
Expand All @@ -41,6 +41,6 @@ entries:
- https://github.com/phasehq/kubernetes-secrets-operator
type: application
urls:
- phase-kubernetes-operator-1.2.2.tgz
version: 1.2.2
generated: "2024-10-27T13:18:22.352479025+05:30"
- phase-kubernetes-operator-1.2.3.tgz
version: 1.2.3
generated: "2024-10-29T13:20:00.664090903+05:30"
Binary file removed helm-repo/phase-kubernetes-operator-1.2.2.tgz
Binary file not shown.
Binary file added helm-repo/phase-kubernetes-operator-1.2.3.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion phase-kubernetes-operator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ type: application
version: 1.2.3

# Version of the application (operator) that is being deployed
appVersion: "1.2.2"
appVersion: "1.2.3"

# Keywords, maintainers, and source URLs can also be added here
keywords:
Expand Down
2 changes: 1 addition & 1 deletion src/utils/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import re
__version__ = "1.2.2"
__version__ = "1.2.3"
__ph_version__ = "v1"

description = "Securely manage application secrets and environment variables with Phase."
Expand Down
2 changes: 1 addition & 1 deletion src/utils/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def construct_http_headers(token_type: str, app_token: str) -> Dict[str, str]:
Dict[str, str]: The common headers including User-Agent.
"""
return {
"Authorization": f"Bearer {token_type.capitalize()} {app_token}",
"Authorization": f"Bearer {token_type} {app_token}",
"User-Agent": get_user_agent()
}

Expand Down
11 changes: 8 additions & 3 deletions src/utils/phase_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,16 @@ def __init__(self, init=True, pss=None, host=None):
token_type = "service token" if "pss_service" in app_secret else "user token"
raise ValueError(f"Invalid Phase {token_type}")

# Storing the token type as a string for easier access
self._token_type = "service" if self.is_service_token else "user"

# Store token segments
pss_segments = app_secret.split(':')
self._app_secret = AppSecret(*pss_segments)

# If type service_token && version == 2; set token header as ServiceAccount
if self.is_service_token and self._app_secret.pes_version == "v2":
self._token_type = "ServiceAccount"
# Else decide between User token or legacy service token header
else:
self._token_type = "Service" if self.is_service_token else "User"


def _find_matching_environment_key(self, user_data, env_id):
Expand Down

0 comments on commit fd82dbc

Please sign in to comment.