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

fix: release: v0.17-dev #27

Merged
merged 5 commits into from
Apr 8, 2024
Merged
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
18 changes: 14 additions & 4 deletions .github/workflows/build-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
if [ "${{ github.event_name }}" == "release" ]; then
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:stable,${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ github.event.release.tag_name }}
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then
TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend:latest
TAG=${{ secrets.DOCKERHUB_USERNAME }}/plane-frontend-arm64:latest
else
TAG=${{ env.FRONTEND_TAG }}
fi
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:
needs: [branch_build_setup, branch_build_frontend_amd64, branch_build_frontend_arm64]
if: ${{ contains(needs.branch_build_setup.outputs.gh_buildx_platforms, 'linux/arm64') }}
env:
FRONTEND_TAG: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ needs.branch_build_setup.outputs.gh_branch_name }}
FRONTEND_TAG: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend:${{ needs.branch_build_setup.outputs.gh_branch_name }}
FRONTEND_TAG_AMD64: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:${{ needs.branch_build_setup.outputs.gh_branch_name }}
FRONTEND_TAG_ARM64: ${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ needs.branch_build_setup.outputs.gh_branch_name }}
TARGET_BRANCH: ${{ needs.branch_build_setup.outputs.gh_branch_name }}
Expand All @@ -261,7 +261,7 @@ jobs:
if [ "${{ github.event_name }}" == "release" ]; then
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:${{ github.event.release.tag_name }}
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:stable
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-amd64:latest
else
TAG=${{ env.FRONTEND_TAG_AMD64 }}
fi
Expand All @@ -272,7 +272,7 @@ jobs:
if [ "${{ github.event_name }}" == "release" ]; then
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:${{ github.event.release.tag_name }}
elif [ "${{ env.TARGET_BRANCH }}" == "master" ]; then
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:stable
TAG=${{ secrets.DOCKER_REGISTRY }}/${{ secrets.DOCKER_REPO }}/plane-frontend-arm64:latest
else
TAG=${{ env.FRONTEND_TAG_ARM64 }}
fi
Expand All @@ -296,6 +296,16 @@ jobs:
${{ env.FRONTEND_TAG_AMD64 }}
${{ env.FRONTEND_TAG_ARM64 }}

- name: Push Frontend to Docker Container Registry
uses: int128/docker-manifest-create-action@v2
if: ${{ github.event_name == 'release' }}
with:
tags: |
${{ env.FRONTEND_TAG }}
sources: |
${{ env.FRONTEND_TAG_AMD64 }}
${{ env.FRONTEND_TAG_ARM64 }}

branch_build_push_space:
if: ${{ needs.branch_build_setup.outputs.build_space == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' || needs.branch_build_setup.outputs.gh_branch_name == 'master' }}
runs-on: ubuntu-20.04
Expand Down
47 changes: 20 additions & 27 deletions apiserver/plane/app/views/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,45 +101,38 @@ def get_access_token(request_token: str, client_id: str) -> str:
A string representing the access token issued out by the OIDC Provider
"""

if not request_token:
raise ValueError("The request token has to be supplied!")
if not request_token or not client_id:
raise ValueError("Both request_token and client_id must be supplied!")

(ACCESS_TOKEN_URL, CLIENT_SECRET, WEB_URL) = get_configuration_value(
[
{
"key": "OIDC_URL_TOKEN",
"default": os.environ.get("OIDC_URL_TOKEN", None),
},
{
"key": "OIDC_CLIENT_SECRET",
"default": os.environ.get("OIDC_CLIENT_SECRET", None),
},
{
"key": "WEB_URL",
"default": os.environ.get("WEB_URL", None),
},
]
)
(ACCESS_TOKEN_URL, CLIENT_SECRET, WEB_URL) = get_configuration_value([
{"key": "OIDC_URL_TOKEN", "default": os.environ.get("OIDC_URL_TOKEN")},
{"key": "OIDC_CLIENT_SECRET", "default": os.environ.get("OIDC_CLIENT_SECRET")},
{"key": "WEB_URL", "default": os.environ.get("WEB_URL")},
])

url = f"{ACCESS_TOKEN_URL}"
if not all([ACCESS_TOKEN_URL, CLIENT_SECRET, WEB_URL]):
raise ValueError("Configuration values for ACCESS_TOKEN_URL, CLIENT_SECRET, or WEB_URL are missing.")

url = ACCESS_TOKEN_URL
data = {
"grant_type": "authorization_code",
"code": request_token,
"redirect_uri": WEB_URL,
"redirect_uri": os.path.join(WEB_URL, ''),
}
basic_auth = b64encode(f"{client_id}:{CLIENT_SECRET}".encode('utf-8')).decode("ascii")
headers = {
"accept": "application/json",
"content-type": "application/x-www-form-urlencoded",
"Authorization": "Basic " + basic_auth,
"Authorization": f"Basic {basic_auth}",
}

res = requests.post(url, headers=headers, data=data)

data = res.json()
access_token = data["access_token"]
response = requests.post(url, headers=headers, data=data)

return access_token
data = response.json()
if 'access_token' in data:
return data["access_token"]
else:
raise Exception(f"Failed to obtain access token: {str(data)}")


def get_user_data(access_token: str) -> dict:
Expand Down Expand Up @@ -215,7 +208,7 @@ def post(self, request):
data = get_user_data(access_token)

email = data.get("email", None)
if email == None:
if email is None:
return Response(
{
"error": "Something went wrong. Please try again later or contact the support team. Email not found."
Expand Down
16 changes: 14 additions & 2 deletions web/components/account/o-auth/oidc-sign-in.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// react
import { useEffect, useState, FC, useCallback } from "react";
import { useEffect, useState, FC, useCallback, useMemo } from "react";
// next
import Image from "next/image";
import Link from "next/link";
Expand Down Expand Up @@ -62,7 +62,19 @@ export const OidcSignInButton: FC<OidcSignInButtonProps> = (props) => {
[clientId, handleSignInRedirection]
);

const oidcRedirect = `${authUrl}?client_id=${clientId}&redirect_uri=${loginCallBackURL}&scope=openid%20profile%20email&response_type=code`;
function randomState() {
const length = 8;
const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
let result = "";
for (let i = length; i > 0; --i) result += chars[Math.round(Math.random() * (chars.length - 1))];
return result;
}

const oidcRedirect = useMemo(
() =>
`${authUrl}?client_id=${clientId}&redirect_uri=${loginCallBackURL}&scope=openid%20profile%20email&response_type=code&state=${randomState()}`,
[authUrl, clientId, loginCallBackURL]
);

useEffect(() => {
if (code && !oidcCode) {
Expand Down
4 changes: 2 additions & 2 deletions web/components/instance/oidc-config-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { IFormattedInstanceConfiguration } from "@plane/types";
// ui
import { Button, Input, ToggleSwitch, TOAST_TYPE, setToast } from "@plane/ui";
// hooks
import { useApplication } from "hooks/store";
import { useApplication } from "@/hooks/store";

export interface IInstanceOidcConfigForm {
config: IFormattedInstanceConfiguration;
Expand Down Expand Up @@ -199,7 +199,7 @@ export const InstanceOidcConfigForm: FC<IInstanceOidcConfigForm> = (props) => {
variant="neutral-primary"
className="flex items-center justify-between py-2"
onClick={() => {
navigator.clipboard.writeText(originURL + "/*");
navigator.clipboard.writeText(originURL + "/");
setToast({
message: "The Redirect URL has been successfully copied to your clipboard",
type: TOAST_TYPE.SUCCESS,
Expand Down
Loading
Loading