Skip to content
Snippets Groups Projects
Commit c43d8ec7 authored by kaiyou's avatar kaiyou
Browse files

Add a seafile application template

parent 2c9fbc62
No related branches found
No related tags found
No related merge requests found
......@@ -32,3 +32,34 @@ class GitlabApplication(base.OIDCApplication):
obj=service,
application_uri=service.config.get("application_uri")
)
@register("seafile")
class SeafileApplication(base.OIDCApplication):
""" Seafile is a file sharing and synchronization application with a Web viewer
"""
name = _("Seafile")
class Form(base.BaseForm):
application_uri = fields.StringField(_("Seafile URL"), [validators.URL(require_tld=False)])
submit = fields.SubmitField(_('Submit'))
def populate_service(self, form, service):
service.profile_regex = "[a-z0-9_.\-]*"
callback_uri = form.application_uri.data + "/users/auth/openid_connect/callback"
service.config.update({
"application_uri": form.application_uri.data,
"token_endpoint_auth_method": "client_secret_post",
"redirect_uris": [callback_uri],
"grant_types": ["authorization_code"],
"response_types": ["code"],
"special_mappings": []
})
self.fill_service(service)
def populate_form(self, service, form):
form.process(
obj=service,
application_uri=service.config.get("application_uri")
)
\ No newline at end of file
<h3>Setting up Seafile</h3>
<p>Seafile supports OIDC authentication through its Seahub frontend.</p>
<p>In order to enable OIDC, you may add the following settings to your `seahub_settings.py` file.</p>
<pre>
# Authentication
ENABLE_OAUTH = True
OAUTH_ENABLE_INSECURE_TRANSPORT = True
OAUTH_CLIENT_ID = "{{ service.config["client_id"] }}"
OAUTH_CLIENT_SECRET = "{{ service.config["client_secret"] }}"
OAUTH_REDIRECT_URL = "{{ service.config["redirect_uris"][0] }}"
OAUTH_PROVIDER_DOMAIN = "<your hiboo domain>"
OAUTH_AUTHORIZATION_URL = "{{ url_for("sso.oidc_authorize", service_uuid=service.uuid, _external=True) }}"
OAUTH_TOKEN_URL = "{{ url_for("sso.oidc_authorize", service_uuid=service.uuid, _external=True) }}"
OAUTH_USER_INFO_URL = "{{ url_for("sso.oidc_authorize", service_uuid=service.uuid, _external=True) }}"
OAUTH_SCOPE = ["openid", "profile", "email"]
OAUTH_ATTRIBUTE_MAP = {
"id": (False, "no_destination"),
"name": (True, "name"),
"email": (True, "email")
}
</pre>
{% include "application_oidc.html" %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment