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

Support AUTHGEAR_WEB_SDK_SESSION_TYPE #42

Open
wants to merge 1 commit into
base: master
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
15 changes: 15 additions & 0 deletions authgear/templates/authgear-portal-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ roleRef:
kind: Role
name: {{ include "authgear.namePortal" . | quote }}
apiGroup: rbac.authorization.k8s.io
{{- if (eq .Values.authgear.portalServer.authgear.webSDKSessionType "cookie") }}
---
apiVersion: v1
kind: ConfigMap
Expand Down Expand Up @@ -111,6 +112,7 @@ data:
}
}
}
{{- end }}
---
apiVersion: apps/v1
kind: Deployment
Expand All @@ -130,9 +132,11 @@ spec:
spec:
serviceAccountName: {{ include "authgear.namePortal" . | quote }}
volumes:
{{- if (eq .Values.authgear.portalServer.authgear.webSDKSessionType "cookie") }}
- name: volume-nginx-conf
configMap:
name: {{ include "authgear.namePortal" . | quote }}
{{- end }}
- name: volume-ingress-template
configMap:
name: {{ include "authgear.nameIngressTemplate" . | quote }}
Expand Down Expand Up @@ -170,6 +174,7 @@ spec:
{{- .Values.authgear.portalServer.topologySpreadConstraints | toYaml | nindent 6 }}
{{- end }}
containers:
{{- if (eq .Values.authgear.portalServer.authgear.webSDKSessionType "cookie") }}
- name: authgear-portal-server-proxy
image: {{ .Values.authgear.portalServerProxy.image | quote }}
imagePullPolicy: Always
Expand All @@ -181,6 +186,7 @@ spec:
- name: proxy
containerPort: 80
protocol: TCP
{{- end }}
- name: authgear-portal-server
image: {{ .Values.authgear.portalServer.image | quote }}
imagePullPolicy: Always
Expand Down Expand Up @@ -241,6 +247,8 @@ spec:
value: {{ .Values.authgear.portalServer.authgear.clientID | quote }}
- name: AUTHGEAR_ENDPOINT
value: {{ .Values.authgear.portalServer.authgear.endpoint | quote }}
- name: AUTHGEAR_WEB_SDK_SESSION_TYPE
value: {{ .Values.authgear.portalServer.authgear.webSDKSessionType | quote }}
- name: ADMIN_API_ENDPOINT
value: {{ .Values.authgear.portalServer.adminAPI.endpoint | quote }}
- name: ADMIN_API_HOST_TEMPLATE
Expand Down Expand Up @@ -342,10 +350,17 @@ metadata:
{{- include "authgear.labels" . | nindent 4 }}
spec:
ports:
{{- if (eq .Values.authgear.portalServer.authgear.webSDKSessionType "cookie") }}
- port: 80
targetPort: proxy
protocol: TCP
name: http
{{- else }}
- port: 80
targetPort: portal
protocol: TCP
name: http
{{- end }}
Comment on lines +353 to +363
Copy link
Contributor

Choose a reason for hiding this comment

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

I think access token should work with the proxy too so maybe we can simply always use the proxy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will not include a separate proxy for the portal in ONCE, so it is better align the deployment. When sessionType=refresh_token, there is no dedicated proxy in front of the portal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

staging has been updated to use this change now. Encountered an issue https://linear.app/authgear/issue/DEV-2432/validatescopes-does-not-respect-always-allowed-grant-types but that can be worked around by setting grant_types explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should be good to merge.

selector:
{{- include "authgear.portalSelectorLabels" . | nindent 4 }}
{{- if .Values.authgear.portalServer.hpa.enabled }}
Expand Down
3 changes: 3 additions & 0 deletions authgear/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ authgear:
appID: __replace_me__
clientID: __replace_me__
endpoint: https://__replace_me__.example.com
# Consider changing the default to refresh_token in the next major version.
# cookie or refresh_token
webSDKSessionType: cookie

adminAPI:
endpoint: http://cluster.local
Expand Down