2021-05-18 06:13:56 +00:00
|
|
|
from synapse.handlers.oidc import OidcMappingProvider
|
2020-12-11 09:07:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
class NextcloudOidcMappingProvider(OidcMappingProvider):
|
|
|
|
def __init__(self, config):
|
|
|
|
self._config = config
|
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def parse_config(config):
|
|
|
|
return {}
|
|
|
|
|
|
|
|
def get_remote_user_id(self, userinfo):
|
|
|
|
return userinfo["ocs"]["data"]["id"]
|
|
|
|
|
|
|
|
async def map_user_attributes(self, userinfo, token):
|
|
|
|
localpart = userinfo["ocs"]["data"]["id"]
|
|
|
|
display_name = userinfo["ocs"]["data"]["display-name"]
|
|
|
|
return {"localpart": localpart, "display_name": display_name}
|
|
|
|
|
|
|
|
async def get_extra_attributes(self, userinfo, token):
|
|
|
|
extras = {}
|
|
|
|
return extras
|