seafile

在Authsaur中创建应用

进入应用市场 ,点击 Seafile,填写相关信息。

配置 Seafile

根据 Seafile 文档,找到 Seafile 配置文件 seahub_settings.py,加入如下配置。

ENABLE_OAUTH = True

# If create new user when he/she logs in Seafile for the first time, defalut `True`.
OAUTH_CREATE_UNKNOWN_USER = True

# If active new user when he/she logs in Seafile for the first time, defalut `True`.
OAUTH_ACTIVATE_USER_AFTER_CREATION = True

# Usually OAuth works through SSL layer. If your server is not parametrized to allow HTTPS, some method will raise an "oauthlib.oauth2.rfc6749.errors.InsecureTransportError". Set this to `True` to avoid this error.
OAUTH_ENABLE_INSECURE_TRANSPORT = True

# Client id/secret generated by authorization server when you register your client application.
OAUTH_CLIENT_ID = "your-client-id"
OAUTH_CLIENT_SECRET = "your-client-secret"

# Callback url when user authentication succeeded. Note, the redirect url you input when you register your client application MUST be exactly the same as this value.
OAUTH_REDIRECT_URL = 'http://36.140.31.89:6380/oauth/callback/'

# The following should NOT be changed if you are using Github as OAuth provider.
OAUTH_PROVIDER_DOMAIN = 'example.com'
OAUTH_AUTHORIZATION_URL = 'http://116.205.137.175/oauth2.0/authorize'
OAUTH_TOKEN_URL = 'http://116.205.137.175/oauth2.0/accessToken'
OAUTH_USER_INFO_URL = 'http://116.205.137.175/oauth2.0/profile'
OAUTH_SCOPE = ["profile",]
OAUTH_ATTRIBUTE_MAP = {
    "umail": (True, "email"),
    "uname": (False, "name"),
}

配置完成后重启 Seafile。

体验登录

在 Authsaur 中进入刚刚创建的应用的详情,点击体验登录。

在登录界面输入账号密码,即可登录成功。