Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ endif
.PHONY: clean
clean:
cabal clean
$(MAKE) -C services/nginz clean
-rm -rf dist

.PHONY: clean-hint
Expand Down
2 changes: 1 addition & 1 deletion changelog.d/2-features/pr-2882
Original file line number Diff line number Diff line change
@@ -1 +1 @@
New OAuth endpoints for registering an OAuth app and for retrieving an authorization code (#2882, #2901)
New OAuth endpoints for registering an OAuth app, for retrieving an authorization code, and for retrieving an access token (#2882, #2901, #2907)
9 changes: 9 additions & 0 deletions charts/brig/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -299,5 +299,14 @@ data:
{{- if .setEnableMLS }}
setEnableMLS: {{ .setEnableMLS }}
{{- end }}
{{- if $.Values.secrets.oauthJwkKeyPair }}
setOAuthJwkKeyPair: /etc/wire/brig/secrets/jwk_oauth.json
{{- end }}
{{- if .setOAuthAuthCodeExpirationTimeSecs }}
setOAuthAuthCodeExpirationTimeSecs: {{ .setOAuthAuthCodeExpirationTimeSecs }}
{{- end }}
{{- if .setOAuthAccessTokenExpirationTimeSecs }}
setOAuthAccessTokenExpirationTimeSecs: {{ .setOAuthAccessTokenExpirationTimeSecs }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 3 additions & 0 deletions charts/brig/templates/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@ data:
{{- if .dpopSigKeyBundle }}
dpop_sig_key_bundle.pem: {{ .dpopSigKeyBundle | b64enc | quote }}
{{- end }}
{{- if .oauthJwkKeyPair }}
jwk_oauth.json: {{ .oauthJwkKeyPair | b64enc | quote }}
{{- end }}
{{- end }}

2 changes: 2 additions & 0 deletions charts/brig/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ config:
setNonceTtlSecs: 300 # 5 minutes
setDpopMaxSkewSecs: 1
setDpopTokenExpirationTimeSecs: 300 # 5 minutes
setOAuthAuthCodeExpirationTimeSecs: 300 # 5 minutes
setOAuthAccessTokenExpirationTimeSecs: 1814400 # 3 weeks
smtp:
passwordFile: /etc/wire/brig/secrets/smtp-password.txt
proxy: {}
Expand Down
4 changes: 4 additions & 0 deletions charts/nginz/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,10 @@ nginx_conf:
- path: /oauth/authorization/codes
envs:
- all
- path: /oauth/token
envs:
- all
disable_zauth: true
galley:
- path: /conversations/code-check
disable_zauth: true
Expand Down
25 changes: 25 additions & 0 deletions docs/src/developer/reference/config-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -604,3 +604,28 @@ If there is no configuration for a domain, it's defaulted to `no_search`.
#### `setEnableDevelopmentVersions`

This options determines whether development versions should be enabled. If set to `False`, all development versions are removed from the `supported` field of the `/api-version` endpoint. Note that they are still listed in the `development` field, and continue to work normally.

### OAuth

#### JWK

Optionally, configure the JWK to sign and verify OAuth access tokens for local testing as follows:

```yaml
# [brig.yaml]
optSettings:
# ...
setOAuthJwkKeyPair: test/resources/oauth/jwk.json
```

#### Expiration time

Optionally, configure the OAuth authorization code and access token expiration time in seconds as follows:

```yaml
# [brig.yaml]
optSettings:
# ...
setOAuthAuthCodeExpirationTimeSecs: 300 # 5 minutes
setOAuthAccessTokenExpirationTimeSecs: 1814400 # 3 weeks
```
1 change: 1 addition & 0 deletions docs/src/how-to/install/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Installing wire-server
(production) Other configuration options <configuration-options.rst>
Server and team feature settings <team-feature-settings.md>
Messaging Layer Security (MLS) <mls.md>
OAuth <oauth.md>
Web app settings <web-app-settings.md>
sft
restund
Expand Down
45 changes: 45 additions & 0 deletions docs/src/how-to/install/oauth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# OAuth

To use the OAuth functionality, you will need to set up a public and private JSON web key pair (JWK) in the wire-server helm chart. This key pair will be used to sign and verify OAuth access tokens.

To configure the JWK, go to `brig.secrets.oauthJwkKeyPair` in the wire-server helm chart and provide the JWK information, as shown in the example below:

```yaml
# values.yaml or secrets.yaml
brig:
secrets:
oauthJwkKeyPair: |
{
"p":"8U9gI_...",
"kty":"RSA",
"q":"43dqC...",
"d":"ixZk7x...",
"e":"AQAB",
"use":"sig",
"kid":"QVapB_J...",
"qi":"sYHbPsy...",
"dp":"LFmnVNPW...",
"alg":"RS256",
"dq":"UXTY7...",
"n":"1mnyGVT..."
}
```

Note that the JWK is a sensitive configuration value, so it is recommended to use Helm's support for managing secrets instead of including it in a plaintext values.yaml file.

Please keep in mind that OAuth is currently under development and may not be available for use yet. Once it is ready, you will be able to use the OAuth functionality by setting up the JWK as described above.

### OAuth authorization code and access token expiration

The the OAuth authorization code expiration (default 5 minutes) and access token expiration (default 3 weeks) can be overridden in the Helm file as follows:

```yaml
brig:
# ...
config:
# ...
optSettings:
# ...
setOAuthAuthCodeExpirationTimeSecs: 300 # 5 minutes
setOAuthAccessTokenExpirationTimeSecs: 1814400 # 3 weeks
```
17 changes: 17 additions & 0 deletions hack/helm_vars/wire-server/values.yaml.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ brig:
setDpopMaxSkewSecs: 1
setDpopTokenExpirationTimeSecs: 300
setEnableMLS: true
setOAuthAuthCodeExpirationTimeSecs: 3 # 3 secs
setOAuthAccessTokenExpirationTimeSecs: 1814400 # 3 weeks
aws:
sesEndpoint: http://fake-aws-ses:4569
sqsEndpoint: http://fake-aws-sqs:4568
Expand Down Expand Up @@ -121,6 +123,21 @@ brig:
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEACPvhIdimF20tOPjbb+fXJrwS2RKDp7686T90AZ0+Th8=
-----END PUBLIC KEY-----
oauthJwkKeyPair: |
{
"p":"8U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61pqf6VmAoF8chqPI_178q0CSxV_JoERhIZUKizgD3mpFyS1ArjygBREiI5c",
"alg":"RS256",
"dq":"UXTY7yryQhql-mfugc_q98CanKuU8G17r5xrbw5wriTwCPOmsFJzZr8UdCorkA_oTw8CpsrwXUBEJJUA-9R3tKhYjfxsGP-nIAsMyfHdkI2SlsztYQ9f8wE39Bs_z4qKZTJyprvdKY76DKvMh7YDm-Wx8_8VA0GZWUN6ldFa2lU",
"n":"1mnyGVTdwCi4umlGMvT6y7aTmibMQuBvySoT5eZcwKti4_sfnEJhyWXfsE6tasUC8ce7YGzFiq886S9-iZc6hYW0ReIPQYCLZ5hn-fUCxefEZdX03e-uJww7OwX_kNQifgdYwzM__QJsy1_nbgEn7olTzplJfJmUSk9dkfFJ-3o5L3AJ1YMbFPgXae0OLmkxjVKfT_6093a0RLSpUCzcti4OhtNa-OEUMX4rYl0jQyzZyO281IH-MatecA1O_o6JbCI1wH46jWNY8of43cemzFwQaS2SnSyppOmJzGf9fpm5j5dozYrAdTdPYdZEA62CimvdLvJqEt4OjyQuRTAuCw"
}
tests:
enableFederationTests: true
cannon:
Expand Down
22 changes: 18 additions & 4 deletions nix/haskell-pins.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
# 1. If your target git repository has only package with the cabal file at the
# root, add it like this under 'gitPins':
# <name-of-the-package> = {
# src = fetchgit = {
# url = "<https-url-to-git>"
# src = fetchgit {
# url = "<https-url-to-git>";
# rev = "<commit-id/sha>";
# sha256 = "";
# }
# }
# };
# };
#
# 2. If your target git repsitory has many packages, add it like this under 'gitPins':
#
Expand Down Expand Up @@ -227,6 +227,20 @@ let
sha256 = "sha256-8XeCeJWbkdqrUf6tERFMoGM8xRI5l/nKNqI810kzMs0=";
};
};
tasty-hedgehog = {
src = fetchgit {
url = "https://github.com/qfpl/tasty-hedgehog";
rev = "729617f82699be189954825920d6f30985e1cfa7";
sha256 = "sha256-O81wlQbzwCOWLueDLiqf/K2g9XWvSNWgHv7IbYmLsgI=";
};
};
jose = {
src = fetchgit {
url = "https://github.com/frasertweedale/hs-jose";
rev = "a7f919b19f667dfbb4d5c989ce620d3e75af8247";
sha256 = "sha256-SKEE9ZqhjBxHYUKQaoB4IpN4/Ui3tS4S98FgZqj7WlY=";
};
};
kind-generics = {
src = fetchgit {
url = "https://gitlab.com/trupill/kind-generics.git";
Expand Down
4 changes: 4 additions & 0 deletions services/brig/brig.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ library
Brig.Effects.Delay
Brig.Effects.GalleyProvider
Brig.Effects.GalleyProvider.RPC
Brig.Effects.Jwk
Brig.Effects.JwtTools
Brig.Effects.PasswordResetStore
Brig.Effects.PasswordResetStore.CodeStore
Expand Down Expand Up @@ -230,6 +231,7 @@ library
, HsOpenSSL >=0.10
, HsOpenSSL-x509-system >=0.1
, html-entities >=1.1
, http-api-data
, http-client >=0.5
, http-client-openssl >=0.2
, http-media
Expand All @@ -238,6 +240,7 @@ library
, insert-ordered-containers
, iproute >=1.5
, iso639 >=0.1
, jose
, jwt-tools
, lens >=3.8
, lens-aeson >=1.0
Expand Down Expand Up @@ -555,6 +558,7 @@ executable brig-integration
, http-reverse-proxy
, http-types
, imports
, jose
, lens >=3.9
, lens-aeson
, metrics-wai
Expand Down
3 changes: 3 additions & 0 deletions services/brig/brig.integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ optSettings:
setDpopTokenExpirationTimeSecs: 300 # 5 minutes
setPublicKeyBundle: test/resources/jwt/ed25519_bundle.pem
setEnableMLS: true
setOAuthJwkKeyPair: test/resources/oauth/jwk.json
setOAuthAuthCodeExpirationTimeSecs: 3 # 3 secs
setOAuthAccessTokenExpirationTimeSecs: 1814400 # 3 weeks

logLevel: Warn
# ^ NOTE: We log too much in brig, if we set this to Info like other services, running tests
Expand Down
4 changes: 4 additions & 0 deletions services/brig/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
, insert-ordered-containers
, iproute
, iso639
, jose
, jwt-tools
, lens
, lens-aeson
Expand Down Expand Up @@ -213,6 +214,7 @@ mkDerivation {
HsOpenSSL
HsOpenSSL-x509-system
html-entities
http-api-data
http-client
http-client-openssl
http-media
Expand All @@ -221,6 +223,7 @@ mkDerivation {
insert-ordered-containers
iproute
iso639
jose
jwt-tools
lens
lens-aeson
Expand Down Expand Up @@ -332,6 +335,7 @@ mkDerivation {
http-reverse-proxy
http-types
imports
jose
lens
lens-aeson
metrics-wai
Expand Down
Loading