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

feat: OpenID Connect for Self Hosted Instance with God-Mode Implementation #3341

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c3ba9f6
Merge pull request #3290 from makeplane/develop
sriramveeraghanta Dec 30, 2023
c9b628e
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Jan 4, 2024
ecc8fbd
fix: Login workflow depending on smtp is configured (#3307)
sriramveeraghanta Jan 4, 2024
eec411b
dev: new create issue modal (#3312)
aaryan610 Jan 4, 2024
0927fa1
✨ chore: Updated TableView component in table extension to solve sent…
Palanikannan1437 Jan 4, 2024
69b1d0a
Fixes 3299 (#3308)
JiginJayaprakash Jan 4, 2024
ce21630
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Jan 4, 2024
d98b688
fix: merge conflicts resolved
sriramveeraghanta Jan 4, 2024
9dd8c8b
chore: UI/UX improvements (#3319)
prateekshourya29 Jan 5, 2024
cf64c7b
fix: project identifier cursor behaviour in create project modal. (#3…
prateekshourya29 Jan 5, 2024
2f10f35
chore: bug fixes and improvement (#3303)
anmolsinghbhatia Jan 5, 2024
81f6557
fix: workspace invitations response updated (#3321)
anmolsinghbhatia Jan 5, 2024
455c2cc
fix: pages store structure changes
sriramveeraghanta Jan 7, 2024
a71491e
fix: estimate order not maintained in create/ update modal. (#3326)
prateekshourya29 Jan 8, 2024
eccb1f5
fix: breaking cycle issues and replacing router.push with Links (#3330)
rahulramesha Jan 8, 2024
5cd93f5
chore(deps): bump tj-actions/changed-files in /.github/workflows (#3327)
dependabot[bot] Jan 8, 2024
94b72ef
chore: mobile configs (#3328)
NarayanBavisetti Jan 8, 2024
02a7763
fix: security warnings related to information exposure and regex vali…
pablohashescobar Jan 8, 2024
4b0ccea
fix: jira importer validations (#3323)
pablohashescobar Jan 8, 2024
c38e048
Merge branches 'fix/pages-store' and 'develop' of github.com:makeplan…
sriramveeraghanta Jan 8, 2024
cb2a7d0
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Jan 8, 2024
d887b78
fix: update jira summary endpoints (#3333)
pablohashescobar Jan 9, 2024
cb3a73e
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Jan 9, 2024
2580e66
fixes web container public assets (#3336)
mguptahub Jan 9, 2024
08e5f2b
Merge branch 'preview' of github.com:makeplane/plane into develop
sriramveeraghanta Jan 9, 2024
8b884ab
chore: modal and dropdown improvement (#3332)
anmolsinghbhatia Jan 10, 2024
57594aa
dev: update the instance urls (#3329)
pablohashescobar Jan 10, 2024
96fae4d
Support OIDC Authentication including automatic redirect and configur…
torbenraab Jan 10, 2024
a481572
Fix some of the reported deepsource analytic problems
torbenraab Jan 10, 2024
30ce316
Remove print() from code as it was only for debug
torbenraab Jan 16, 2024
b3d545f
Update Docker Compose File for Selfhosting & Update OIDCEndpoint to h…
torbenraab Jan 17, 2024
f64f945
Change Naming of OIDC Issuer to OIDC Discovery and only append the .w…
torbenraab Jan 23, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build-test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v38
uses: tj-actions/changed-files@v41
with:
files_yaml: |
apiserver:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: "CodeQL"

on:
push:
branches: [ 'develop', 'hot-fix', 'stage-release' ]
branches: [ 'develop', 'preview', 'master' ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ 'develop' ]
branches: [ 'develop', 'preview', 'master' ]
schedule:
- cron: '53 19 * * 5'

Expand Down
14 changes: 11 additions & 3 deletions apiserver/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ OPENAI_API_BASE="https://api.openai.com/v1" # deprecated
OPENAI_API_KEY="sk-" # deprecated
GPT_ENGINE="gpt-3.5-turbo" # deprecated

# Github
GITHUB_CLIENT_SECRET="" # For fetching release notes

# Settings related to Docker
DOCKERIZED=1 # deprecated

Expand All @@ -61,6 +58,17 @@ ENABLE_EMAIL_PASSWORD="1"
# Enable Magic link Login
ENABLE_MAGIC_LINK_LOGIN="0"

# Enable OpenID Connect Login - You can set the Issuer to get the Enpoints (URLs) automatically or set them manually
# If you set the Endpoints manually the issuer should be empty to avoid overriding the endpoints
OIDC_AUTO="0"
OIDC_CLIENT_ID=""
OIDC_CLIENT_SECRET=""
OIDC_DISCOVERY=""
OIDC_URL_AUTHORIZATION=""
OIDC_URL_TOKEN=""
OIDC_URL_USERINFO=""
OIDC_URL_ENDSESSION=""

# Email redirections and minio domain settings
WEB_URL="http://localhost"

Expand Down
5 changes: 2 additions & 3 deletions apiserver/plane/api/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,14 @@ def handle_exception(self, exc):
)

if isinstance(e, ObjectDoesNotExist):
model_name = str(exc).split(" matching query does not exist.")[0]
return Response(
{"error": f"{model_name} does not exist."},
{"error": f"The required object does not exist."},
status=status.HTTP_404_NOT_FOUND,
)

if isinstance(e, KeyError):
return Response(
{"error": f"key {e} does not exist"},
{"error": f" The required key does not exist."},
status=status.HTTP_400_BAD_REQUEST,
)

Expand Down
35 changes: 18 additions & 17 deletions apiserver/plane/app/serializers/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
CommentReaction,
IssueVote,
IssueRelation,
State,
Project,
)


Expand Down Expand Up @@ -69,19 +71,16 @@ class Meta:
##TODO: Find a better way to write this serializer
## Find a better approach to save manytomany?
class IssueCreateSerializer(BaseSerializer):
state_detail = StateSerializer(read_only=True, source="state")
created_by_detail = UserLiteSerializer(read_only=True, source="created_by")
project_detail = ProjectLiteSerializer(read_only=True, source="project")
workspace_detail = WorkspaceLiteSerializer(read_only=True, source="workspace")

assignees = serializers.ListField(
child=serializers.PrimaryKeyRelatedField(queryset=User.objects.all()),
# ids
state_id = serializers.PrimaryKeyRelatedField(source="state", queryset=State.objects.all(), required=False, allow_null=True)
parent_id = serializers.PrimaryKeyRelatedField(source='parent', queryset=Issue.objects.all(), required=False, allow_null=True)
label_ids = serializers.ListField(
child=serializers.PrimaryKeyRelatedField(queryset=Label.objects.all()),
write_only=True,
required=False,
)

labels = serializers.ListField(
child=serializers.PrimaryKeyRelatedField(queryset=Label.objects.all()),
assignee_ids = serializers.ListField(
child=serializers.PrimaryKeyRelatedField(queryset=User.objects.all()),
write_only=True,
required=False,
)
Expand All @@ -100,8 +99,10 @@ class Meta:

def to_representation(self, instance):
data = super().to_representation(instance)
data['assignees'] = [str(assignee.id) for assignee in instance.assignees.all()]
data['labels'] = [str(label.id) for label in instance.labels.all()]
assignee_ids = self.initial_data.get('assignee_ids')
data['assignee_ids'] = assignee_ids if assignee_ids else []
label_ids = self.initial_data.get('label_ids')
data['label_ids'] = label_ids if label_ids else []
return data

def validate(self, data):
Expand All @@ -114,8 +115,8 @@ def validate(self, data):
return data

def create(self, validated_data):
assignees = validated_data.pop("assignees", None)
labels = validated_data.pop("labels", None)
assignees = validated_data.pop("assignee_ids", None)
labels = validated_data.pop("label_ids", None)

project_id = self.context["project_id"]
workspace_id = self.context["workspace_id"]
Expand Down Expand Up @@ -173,8 +174,8 @@ def create(self, validated_data):
return issue

def update(self, instance, validated_data):
assignees = validated_data.pop("assignees", None)
labels = validated_data.pop("labels", None)
assignees = validated_data.pop("assignee_ids", None)
labels = validated_data.pop("labels_ids", None)

# Related models
project_id = instance.project_id
Expand Down Expand Up @@ -544,7 +545,7 @@ class IssueSerializer(DynamicBaseSerializer):
attachment_count = serializers.IntegerField(read_only=True)
link_count = serializers.IntegerField(read_only=True)

# is
# is_subscribed
is_subscribed = serializers.BooleanField(read_only=True)

class Meta:
Expand Down
2 changes: 2 additions & 0 deletions apiserver/plane/app/urls/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
MagicGenerateEndpoint,
MagicSignInEndpoint,
OauthEndpoint,
OIDCEndpoint,
EmailCheckEndpoint,
## End Authentication
# Auth Extended
Expand All @@ -27,6 +28,7 @@
# Social Auth
path("email-check/", EmailCheckEndpoint.as_view(), name="email"),
path("social-auth/", OauthEndpoint.as_view(), name="oauth"),
path("oidc-auth/", OIDCEndpoint.as_view(), name="oidc"),
# Auth
path("sign-in/", SignInEndpoint.as_view(), name="sign-in"),
path("sign-out/", SignOutEndpoint.as_view(), name="sign-out"),
Expand Down
7 changes: 6 additions & 1 deletion apiserver/plane/app/urls/config.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
from django.urls import path


from plane.app.views import ConfigurationEndpoint
from plane.app.views import ConfigurationEndpoint, MobileConfigurationEndpoint

urlpatterns = [
path(
"configs/",
ConfigurationEndpoint.as_view(),
name="configuration",
),
path(
"mobile-configs/",
MobileConfigurationEndpoint.as_view(),
name="configuration",
),
]
4 changes: 3 additions & 1 deletion apiserver/plane/app/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

from .oauth import OauthEndpoint

from .oidc import OIDCEndpoint

from .base import BaseAPIView, BaseViewSet, WebhookMixin

from .workspace import (
Expand Down Expand Up @@ -165,7 +167,7 @@

from .exporter import ExportIssuesEndpoint

from .config import ConfigurationEndpoint
from .config import ConfigurationEndpoint, MobileConfigurationEndpoint

from .webhook import (
WebhookEndpoint,
Expand Down
14 changes: 6 additions & 8 deletions apiserver/plane/app/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def handle_exception(self, exc):
response = super().handle_exception(exc)
return response
except Exception as e:
print(e) if settings.DEBUG else print("Server Error")
if isinstance(e, IntegrityError):
return Response(
{"error": "The payload is not valid"},
Expand All @@ -112,20 +113,18 @@ def handle_exception(self, exc):
)

if isinstance(e, ObjectDoesNotExist):
model_name = str(exc).split(" matching query does not exist.")[0]
return Response(
{"error": f"{model_name} does not exist."},
{"error": f"The required object does not exist."},
status=status.HTTP_404_NOT_FOUND,
)

if isinstance(e, KeyError):
capture_exception(e)
return Response(
{"error": f"key {e} does not exist"},
{"error": f"The required key does not exist."},
status=status.HTTP_400_BAD_REQUEST,
)

print(e) if settings.DEBUG else print("Server Error")

capture_exception(e)
return Response({"error": "Something went wrong please try again later"}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)

Expand Down Expand Up @@ -216,14 +215,13 @@ def handle_exception(self, exc):
)

if isinstance(e, ObjectDoesNotExist):
model_name = str(exc).split(" matching query does not exist.")[0]
return Response(
{"error": f"{model_name} does not exist."},
{"error": f"The required object does not exist."},
status=status.HTTP_404_NOT_FOUND,
)

if isinstance(e, KeyError):
return Response({"error": f"key {e} does not exist"}, status=status.HTTP_400_BAD_REQUEST)
return Response({"error": f"The required key does not exist."}, status=status.HTTP_400_BAD_REQUEST)

if settings.DEBUG:
print(e)
Expand Down
Loading
Loading