Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Data Logistics Service
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
eFlows4HPC WP2
Data Logistics Service
Commits
d6b98132
Commit
d6b98132
authored
2 years ago
by
Christian Boettcher
Browse files
Options
Downloads
Patches
Plain Diff
check integration via blueprint and single view
parent
86a4103a
No related branches found
No related tags found
No related merge requests found
Pipeline
#131157
passed
2 years ago
Stage: build
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/unity_integration.py
+22
-21
22 additions, 21 deletions
plugins/unity_integration.py
with
22 additions
and
21 deletions
plugins/unity_integration.py
+
22
−
21
View file @
d6b98132
import
os
,
random
,
string
import
os
,
random
,
string
from
authlib.integrations.flask_client
import
OAuth
from
authlib.integrations.flask_client
import
OAuth
from
flask
import
url_for
,
redirect
,
current_app
as
app
from
flask
import
url_for
,
redirect
,
current_app
as
app
,
Blueprint
from
flask_login
import
login_user
from
flask_login
import
login_user
from
flask_appbuilder
import
expose
,
BaseView
as
AppBuilderBaseView
from
flask_appbuilder
import
expose
,
BaseView
as
AppBuilderBaseView
from
airflow.plugins_manager
import
AirflowPlugin
from
airflow.plugins_manager
import
AirflowPlugin
...
@@ -26,16 +26,17 @@ oauth.register(
...
@@ -26,16 +26,17 @@ oauth.register(
)
)
class
UnityIntegrationLoginView
(
AppBuilderBaseView
):
unity
=
Blueprint
(
'
unity
'
,
__name__
,
url_prefix
=
"
/unity
"
)
#@expose("/unity_login")
@app.route
(
'
/unity_login
'
)
class
UnityIntegrationView
(
AppBuilderBaseView
):
def
unity_login
():
redirect_uri
=
url_for
(
'
unity_authorize
'
,
_external
=
True
)
@unity.route
(
'
/login
'
)
def
login
():
redirect_uri
=
url_for
(
'
authorize
'
,
_external
=
True
)
return
oauth
.
unity
.
authorize_redirect
(
redirect_uri
)
return
oauth
.
unity
.
authorize_redirect
(
redirect_uri
)
class
UnityIntegrationAuthView
(
AppBuilderBaseView
):
#@expose("/unity_authorize")
@unity.route
(
'
/authorize
'
)
@app.route
(
'
/unity_authorize
'
)
async
def
authorize
():
async
def
unity_authorize
():
token
=
await
oauth
.
unity
.
authorize_access_token
()
token
=
await
oauth
.
unity
.
authorize_access_token
()
user
=
await
oauth
.
unity
.
userinfo
(
token
=
token
)
user
=
await
oauth
.
unity
.
userinfo
(
token
=
token
)
# get relevant data from token
# get relevant data from token
...
@@ -66,20 +67,20 @@ class UnityIntegrationAuthView(AppBuilderBaseView):
...
@@ -66,20 +67,20 @@ class UnityIntegrationAuthView(AppBuilderBaseView):
login_user
(
fab_user
,
remember
=
False
)
login_user
(
fab_user
,
remember
=
False
)
return
redirect
(
'
/
'
)
return
redirect
(
'
/
'
)
v_unity_login_view
=
UnityIntegrationLoginView
()
@unity.route
(
'
/logout
'
)
v_unity_login_package
=
{
def
logout
():
"
name
"
:
"
Unity Login View
"
,
pass
"
category
"
:
"
Unity Integration
"
,
"
view
"
:
v_unity_login_view
,
}
v_unity_
auth_
view
=
UnityIntegration
Auth
View
()
v_unity_view
=
UnityIntegrationView
()
v_unity_
auth_
package
=
{
v_unity_package
=
{
"
name
"
:
"
Unity
Auth
View
"
,
"
name
"
:
"
Unity
SSO
View
"
,
"
category
"
:
"
Unity Integration
"
,
"
category
"
:
"
Unity Integration
"
,
"
view
"
:
v_unity_
auth_
view
,
"
view
"
:
v_unity_view
,
}
}
class
UnityIntegrationPlugin
(
AirflowPlugin
):
class
UnityIntegrationPlugin
(
AirflowPlugin
):
name
=
"
unity_integration
"
name
=
"
unity_integration
"
appbuilder_views
=
[
v_unity_auth_package
,
v_unity_login_package
]
appbuilder_views
=
[
v_unity_package
]
\ No newline at end of file
flask_blueprints
=
[
unity
]
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment