Skip to content

Commit 4775641

Browse files
committed
Merge branch 'main' of https://github.com/authorizerdev/authorizer into fix/oauth-provider
2 parents 274909b + e525877 commit 4775641

File tree

28 files changed

+523
-93
lines changed

28 files changed

+523
-93
lines changed

.github/workflows/release.yaml

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
default: 'warning'
88
type: choice
99
options:
10-
- info
11-
- warning
12-
- debug
10+
- info
11+
- warning
12+
- debug
1313
tags:
1414
description: 'Tags'
1515
required: false
@@ -19,19 +19,27 @@ on:
1919

2020
jobs:
2121
releases:
22-
name: Release Authorizer Binary
22+
name: Release Authorizer
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626
- uses: actions/setup-node@v2
2727
with:
2828
node-version: '16'
29+
- # Add support for more platforms with QEMU (optional)
30+
# https://github.com/docker/setup-qemu-action
31+
name: Set up QEMU
32+
uses: docker/setup-qemu-action@v2
33+
- name: Set up Docker Buildx
34+
uses: docker/setup-buildx-action@v2
35+
with:
36+
platforms: linux/amd64,linux/arm64
2937
- uses: actions/setup-go@v2
3038
with:
3139
go-version: '^1.19.1'
3240
- name: Install dependencies
3341
run: |
34-
sudo apt-get install build-essential wget zip gcc-mingw-w64 && \
42+
sudo apt-get install build-essential wget zip libc6-dev-arm64-cross && \
3543
echo "/usr/bin/x86_64-w64-mingw32-gcc" >> GITHUB_PATH && \
3644
wget --no-check-certificate --progress=dot:mega https://github.com/wangyoucao577/assets-uploader/releases/download/v0.3.0/github-assets-uploader-v0.3.0-linux-amd64.tar.gz -O github-assets-uploader.tar.gz && \
3745
tar -zxf github-assets-uploader.tar.gz && \
@@ -44,25 +52,26 @@ jobs:
4452
run: whereis go
4553
- name: Print Go Version
4654
run: go version
55+
- name: Install gox
56+
run: go install github.com/mitchellh/gox@latest
4757
- name: Set VERSION env
4858
run: echo VERSION=$(basename ${GITHUB_REF}) >> ${GITHUB_ENV}
4959
- name: Copy .env file
5060
run: mv .env.sample .env
51-
- name: Package files for windows
52-
run: |
53-
make clean && \
54-
CGO_ENABLED=1 GOOS=windows CC=/usr/bin/x86_64-w64-mingw32-gcc make && \
55-
mv build/server build/server.exe && \
56-
zip -vr authorizer-${VERSION}-windows-amd64.zip .env app/build build templates dashboard/build
57-
- name: Package files for linux
61+
- name: Build package
5862
run: |
5963
make clean && \
60-
CGO_ENABLED=1 make && \
61-
tar cvfz authorizer-${VERSION}-linux-amd64.tar.gz .env app/build build templates dashboard/build
64+
make build && \
65+
mkdir -p authorizer-${VERSION}-darwin-amd64/build authorizer-${VERSION}-darwin-amd64/app authorizer-${VERSION}-darwin-amd64/dashboard && cp build/darwin/amd64/server authorizer-${VERSION}-darwin-amd64/build/ && cp .env authorizer-${VERSION}-darwin-amd64/.env && cp -rf app/build authorizer-${VERSION}-darwin-amd64/app/build && cp -rf templates authorizer-${VERSION}-darwin-amd64/ && cp -rf dashboard/build authorizer-${VERSION}-darwin-amd64/dashboard/build && tar cvfz authorizer-${VERSION}-darwin-amd64.tar.gz authorizer-${VERSION}-darwin-amd64 && \
66+
mkdir -p authorizer-${VERSION}-linux-amd64/build authorizer-${VERSION}-linux-amd64/app authorizer-${VERSION}-linux-amd64/dashboard && cp build/linux/amd64/server authorizer-${VERSION}-linux-amd64/build/ && cp .env authorizer-${VERSION}-linux-amd64/.env && cp -rf app/build authorizer-${VERSION}-linux-amd64/app/build && cp -rf templates authorizer-${VERSION}-linux-amd64/ && cp -rf dashboard/build authorizer-${VERSION}-linux-amd64/dashboard/build && tar cvfz authorizer-${VERSION}-linux-amd64.tar.gz authorizer-${VERSION}-linux-amd64 && \
67+
mkdir -p authorizer-${VERSION}-linux-arm64/build authorizer-${VERSION}-linux-arm64/app authorizer-${VERSION}-linux-arm64/dashboard && cp build/linux/arm64/server authorizer-${VERSION}-linux-arm64/build/ && cp .env authorizer-${VERSION}-linux-arm64/.env && cp -rf app/build authorizer-${VERSION}-linux-arm64/app/build && cp -rf templates authorizer-${VERSION}-linux-arm64/ && cp -rf dashboard/build authorizer-${VERSION}-linux-arm64/dashboard/build && tar cvfz authorizer-${VERSION}-linux-arm64.tar.gz authorizer-${VERSION}-linux-arm64 && \
68+
mkdir -p authorizer-${VERSION}-windows-amd64/build authorizer-${VERSION}-windows-amd64/app authorizer-${VERSION}-windows-amd64/dashboard && cp build/windows/amd64/server.exe authorizer-${VERSION}-windows-amd64/build/ && cp .env authorizer-${VERSION}-windows-amd64/.env && cp -rf app/build authorizer-${VERSION}-windows-amd64/app/build && cp -rf templates authorizer-${VERSION}-windows-amd64/ && cp -rf dashboard/build authorizer-${VERSION}-windows-amd64/dashboard/build && zip -vr authorizer-${VERSION}-windows-amd64.zip authorizer-${VERSION}-windows-amd64
6269
- name: Upload assets
6370
run: |
64-
github-assets-uploader -f authorizer-${VERSION}-windows-amd64.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION} && \
71+
github-assets-uploader -f authorizer-${VERSION}-darwin-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
6572
github-assets-uploader -f authorizer-${VERSION}-linux-amd64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
73+
github-assets-uploader -f authorizer-${VERSION}-linux-arm64.tar.gz -mediatype application/gzip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
74+
github-assets-uploader -f authorizer-${VERSION}-windows-amd64.zip -mediatype application/zip -repo authorizerdev/authorizer -token ${{secrets.RELEASE_TOKEN}} -tag ${VERSION}
6675
- name: Log in to Docker Hub
6776
uses: docker/login-action@v1
6877
with:
@@ -74,6 +83,11 @@ jobs:
7483
uses: docker/metadata-action@v3
7584
with:
7685
images: lakhansamani/authorizer
86+
tags: |
87+
type=schedule
88+
type=ref,event=branch
89+
type=ref,event=tag
90+
type=ref,event=pr
7791
7892
- name: Build and push Docker image
7993
uses: docker/build-push-action@v2
@@ -82,5 +96,6 @@ jobs:
8296
push: true
8397
tags: ${{ steps.meta.outputs.tags }}
8498
labels: ${{ steps.meta.outputs.labels }}
99+
platforms: linux/amd64,linux/arm64
85100
build-args: |
86101
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ test.db
1515
.vscode/
1616
.yalc
1717
yalc.lock
18-
certs/
18+
certs/
19+
*-shm
20+
*-wal

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@ VERSION := $(or $(VERSION),$(DEFAULT_VERSION))
33

44
cmd:
55
cd server && go build -ldflags "-w -X main.VERSION=$(VERSION)" -o '../build/server'
6+
build:
7+
cd server && gox \
8+
-osarch="linux/amd64 linux/arm64 darwin/amd64 windows/amd64" \
9+
-ldflags "-w -X main.VERSION=$(VERSION)" \
10+
-output="../build/{{.OS}}/{{.Arch}}/server" \
11+
./...
612
build-app:
713
cd app && npm i && npm run build
814
build-dashboard:
915
cd dashboard && npm i && npm run build
1016
clean:
1117
rm -rf build
1218
test:
13-
rm -rf server/test/test.db && rm -rf test.db && cd server && go clean --testcache && TEST_DBS="sqlite" go test -p 1 -v ./test
19+
rm -rf server/test/test.db server/test/test.db-shm server/test/test.db-wal && rm -rf test.db test.db-shm test.db-wal && cd server && go clean --testcache && TEST_DBS="sqlite" go test -p 1 -v ./test
1420
test-mongodb:
1521
docker run -d --name authorizer_mongodb_db -p 27017:27017 mongo:4.4.15
1622
cd server && go clean --testcache && TEST_DBS="mongodb" go test -p 1 -v ./test
@@ -28,7 +34,7 @@ test-dynamodb:
2834
cd server && go clean --testcache && TEST_DBS="dynamodb" go test -p 1 -v ./test
2935
docker rm -vf dynamodb-local-test
3036
test-all-db:
31-
rm -rf server/test/test.db && rm -rf test.db
37+
rm -rf server/test/test.db server/test/test.db-shm server/test/test.db-wal && rm -rf test.db test.db-shm test.db-wal
3238
docker run -d --name authorizer_scylla_db -p 9042:9042 scylladb/scylla
3339
docker run -d --name authorizer_mongodb_db -p 27017:27017 mongo:4.4.15
3440
docker run -d --name authorizer_arangodb -p 8529:8529 -e ARANGO_NO_AUTH=1 arangodb/arangodb:3.8.4

app/src/pages/login.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ export default function Login({ urlProps }: { urlProps: Record<string, any> }) {
6060
{view === VIEW_TYPES.FORGOT_PASSWORD && (
6161
<Fragment>
6262
<h1 style={{ textAlign: 'center' }}>Forgot Password</h1>
63-
<AuthorizerForgotPassword urlProps={urlProps} />
63+
<AuthorizerForgotPassword
64+
urlProps={{
65+
...urlProps,
66+
redirect_uri: `${window.location.origin}/app/reset-password`,
67+
}}
68+
/>
6469
<Footer>
6570
<Link
6671
to="#"

dashboard/src/components/EditUserModal.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, { useState } from 'react';
22
import {
33
Button,
44
Center,
@@ -20,13 +20,14 @@ import { useClient } from 'urql';
2020
import { FaSave } from 'react-icons/fa';
2121
import InputField from './InputField';
2222
import {
23-
ArrayInputType,
2423
DateInputType,
24+
MultiSelectInputType,
2525
SelectInputType,
2626
TextInputType,
2727
} from '../constants';
2828
import { getObjectDiff } from '../utils';
2929
import { UpdateUser } from '../graphql/mutation';
30+
import { GetAvailableRolesQuery } from '../graphql/queries';
3031

3132
const GenderTypes = {
3233
Undisclosed: null,
@@ -57,8 +58,9 @@ const EditUserModal = ({
5758
}) => {
5859
const client = useClient();
5960
const toast = useToast();
61+
const [availableRoles, setAvailableRoles] = useState<string[]>([]);
6062
const { isOpen, onOpen, onClose } = useDisclosure();
61-
const [userData, setUserData] = React.useState<userDataTypes>({
63+
const [userData, setUserData] = useState<userDataTypes>({
6264
id: '',
6365
email: '',
6466
given_name: '',
@@ -73,7 +75,17 @@ const EditUserModal = ({
7375
});
7476
React.useEffect(() => {
7577
setUserData(user);
78+
fetchAvailableRoles();
7679
}, []);
80+
const fetchAvailableRoles = async () => {
81+
const res = await client.query(GetAvailableRolesQuery).toPromise();
82+
if (res.data?._env?.ROLES && res.data?._env?.PROTECTED_ROLES) {
83+
setAvailableRoles([
84+
...res.data._env.ROLES,
85+
...res.data._env.PROTECTED_ROLES,
86+
]);
87+
}
88+
};
7789
const saveHandler = async () => {
7890
const diff = getObjectDiff(user, userData);
7991
const updatedUserData = diff.reduce(
@@ -221,7 +233,8 @@ const EditUserModal = ({
221233
<InputField
222234
variables={userData}
223235
setVariables={setUserData}
224-
inputType={ArrayInputType.USER_ROLES}
236+
availableRoles={availableRoles}
237+
inputType={MultiSelectInputType.USER_ROLES}
225238
/>
226239
</Center>
227240
</Flex>

dashboard/src/components/EnvComponents/EmailConfiguration.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@ const EmailConfigurations = ({
4848
/>
4949
</Center>
5050
</Flex>
51+
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
52+
<Flex
53+
w={isNotSmallerScreen ? '30%' : '40%'}
54+
justifyContent="start"
55+
alignItems="center"
56+
>
57+
<Text fontSize="sm">SMTP Local Name:</Text>
58+
</Flex>
59+
<Center
60+
w={isNotSmallerScreen ? '70%' : '100%'}
61+
mt={isNotSmallerScreen ? '0' : '3'}
62+
>
63+
<InputField
64+
borderRadius={5}
65+
variables={variables}
66+
setVariables={setVariables}
67+
inputType={TextInputType.SMTP_LOCAL_NAME}
68+
/>
69+
</Center>
70+
</Flex>
5171
<Flex direction={isNotSmallerScreen ? 'row' : 'column'}>
5272
<Flex
5373
w={isNotSmallerScreen ? '30%' : '40%'}

0 commit comments

Comments
 (0)