Fix typo in client registration API for logo_uri
This commit is contained in:
parent
ab46e89a65
commit
670cdef79c
@ -15,7 +15,7 @@
|
|||||||
Registering a Client
|
Registering a Client
|
||||||
====================
|
====================
|
||||||
|
|
||||||
To use the GNU MediaGoblin API you need to use the dynamic client registration. This has been adapted from the `OpenID specification <https://openid.net/specs/openid-connect-registration-1_0.html>`_, this is the only part of OpenID that is being used to serve the purpose to provide the client registration which is used in OAuth.
|
To use the GNU MediaGoblin API you need to use the dynamic client registration. This has been adapted from the `OpenID specification <https://openid.net/specs/openid-connect-registration-1_0.html>`_, this is the only part of OpenID that is being used to serve the purpose to provide the client registration which is used in OAuth.
|
||||||
|
|
||||||
The endpoint is ``/api/client/register``
|
The endpoint is ``/api/client/register``
|
||||||
|
|
||||||
@ -39,8 +39,8 @@ application_type
|
|||||||
application_name
|
application_name
|
||||||
**optional** - This is the name of your client
|
**optional** - This is the name of your client
|
||||||
|
|
||||||
logo_url
|
logo_uri
|
||||||
**optional** - This is a URL of the logo image for your client
|
**optional** - This is a URI of the logo image for your client
|
||||||
|
|
||||||
redirect_uri
|
redirect_uri
|
||||||
**optional** - This is a space seporated list of pre-registered URLs for use at the Authorization Server
|
**optional** - This is a space seporated list of pre-registered URLs for use at the Authorization Server
|
||||||
@ -93,8 +93,8 @@ Using the response we got above we can update the information and add new inform
|
|||||||
"client_id": "vwljdhUMhhNbdKizpjZlxv",
|
"client_id": "vwljdhUMhhNbdKizpjZlxv",
|
||||||
"client_secret": "hJtfhaQzgKerlLVdaeRAgmbcstSOBLRfgOinMxBCHcb",
|
"client_secret": "hJtfhaQzgKerlLVdaeRAgmbcstSOBLRfgOinMxBCHcb",
|
||||||
"application_type": "web",
|
"application_type": "web",
|
||||||
"application_name": "MyClient!",
|
"application_name": "MyClient!",
|
||||||
"logo_url": "https://myclient.org/images/my_logo.png",
|
"logo_uri": "https://myclient.org/images/my_logo.png",
|
||||||
"contacts": "myemail@someprovider.com another_developer@provider.net",
|
"contacts": "myemail@someprovider.com another_developer@provider.net",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,4 +155,3 @@ redirect_uris must be space-separated URLs.
|
|||||||
URI <URI> is not a valid URI
|
URI <URI> is not a valid URI
|
||||||
This is when your URI is invalid.
|
This is when your URI is invalid.
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,15 +125,15 @@ def client_register(request):
|
|||||||
error = "Invalid registration type"
|
error = "Invalid registration type"
|
||||||
return json_response({"error": error}, status=400)
|
return json_response({"error": error}, status=400)
|
||||||
|
|
||||||
logo_url = data.get("logo_url", client.logo_url)
|
logo_uri = data.get("logo_uri", client.logo_url)
|
||||||
if logo_url is not None and not validate_url(logo_url):
|
if logo_uri is not None and not validate_url(logo_uri):
|
||||||
error = "Logo URL {0} is not a valid URL.".format(logo_url)
|
error = "Logo URI {0} is not a valid URI.".format(logo_uri)
|
||||||
return json_response(
|
return json_response(
|
||||||
{"error": error},
|
{"error": error},
|
||||||
status=400
|
status=400
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
client.logo_url = logo_url
|
client.logo_url = logo_uri
|
||||||
|
|
||||||
client.application_name = data.get("application_name", None)
|
client.application_name = data.get("application_name", None)
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ class TestOAuth(object):
|
|||||||
"application_name": "Testificate MD",
|
"application_name": "Testificate MD",
|
||||||
"application_type": "web",
|
"application_type": "web",
|
||||||
"contacts": "someone@someplace.com tuteo@tsengeo.lu",
|
"contacts": "someone@someplace.com tuteo@tsengeo.lu",
|
||||||
"logo_url": "http://ayrel.com/utral.png",
|
"logo_uri": "http://ayrel.com/utral.png",
|
||||||
"redirect_uris": "http://navi-kosman.lu http://gmg-yawne-oeru.lu",
|
"redirect_uris": "http://navi-kosman.lu http://gmg-yawne-oeru.lu",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ class TestOAuth(object):
|
|||||||
assert client.secret == client_info["client_secret"]
|
assert client.secret == client_info["client_secret"]
|
||||||
assert client.application_type == query["application_type"]
|
assert client.application_type == query["application_type"]
|
||||||
assert client.redirect_uri == query["redirect_uris"].split()
|
assert client.redirect_uri == query["redirect_uris"].split()
|
||||||
assert client.logo_url == query["logo_url"]
|
assert client.logo_url == query["logo_uri"]
|
||||||
assert client.contacts == query["contacts"].split()
|
assert client.contacts == query["contacts"].split()
|
||||||
|
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class TestOAuth(object):
|
|||||||
"type": "client_update",
|
"type": "client_update",
|
||||||
"application_name": "neytiri",
|
"application_name": "neytiri",
|
||||||
"contacts": "someone@someplace.com abc@cba.com",
|
"contacts": "someone@someplace.com abc@cba.com",
|
||||||
"logo_url": "http://place.com/picture.png",
|
"logo_uri": "http://place.com/picture.png",
|
||||||
"application_type": "web",
|
"application_type": "web",
|
||||||
"redirect_uris": "http://blah.gmg/whatever https://inboxen.org/",
|
"redirect_uris": "http://blah.gmg/whatever https://inboxen.org/",
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ class TestOAuth(object):
|
|||||||
assert client.application_type == update_query["application_type"]
|
assert client.application_type == update_query["application_type"]
|
||||||
assert client.application_name == update_query["application_name"]
|
assert client.application_name == update_query["application_name"]
|
||||||
assert client.contacts == update_query["contacts"].split()
|
assert client.contacts == update_query["contacts"].split()
|
||||||
assert client.logo_url == update_query["logo_url"]
|
assert client.logo_url == update_query["logo_uri"]
|
||||||
assert client.redirect_uri == update_query["redirect_uris"].split()
|
assert client.redirect_uri == update_query["redirect_uris"].split()
|
||||||
|
|
||||||
def to_authorize_headers(self, data):
|
def to_authorize_headers(self, data):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user