From 093fa22bb36b36af7f02080962c9f0359b3869bf Mon Sep 17 00:00:00 2001 From: jaxoncreed Date: Mon, 21 Oct 2019 16:30:49 -0400 Subject: [PATCH] =?UTF-8?q?Revert=20"Solves=20#133:=20add=20client=5Fname,?= =?UTF-8?q?=20logo=5Furi=20and=20contacts=20fields=20to=20client=20?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 25 --------------------- src/__test__/solid-auth-client.spec.js | 30 -------------------------- src/solid-auth-client.js | 3 --- src/webid-oidc.js | 27 +++++------------------ 4 files changed, 5 insertions(+), 80 deletions(-) diff --git a/README.md b/README.md index 09aed2b..020ab45 100644 --- a/README.md +++ b/README.md @@ -155,31 +155,6 @@ and emits the following events: - `logout ()` when a user logs out - `session (session: Session | null)` when a user logs in or out -### Client registration - -`SolidAuthClient` automatically registers your OIDC client application if it is -unknown to the authorization server, following -[the registration request spec](https://openid.net/specs/openid-connect-registration-1_0.html#RegistrationRequest). - -You can specify some fields of this registration request by passing them to the -`loginSession` parameter of `solid.auth.login`. - -Supported fields are: - -* `client_name` and internationalized variants (`clientName` property) -* `contacts` (`contacts` property) -* `logo_uri` (`contacts` property) - -**Example**: - -```js -solid.auth.login(idp, { - clientName: 'My Example', - 'clientName#ja-Jpan-JP': 'クライアント名', - logoUri: 'https://client.example.org/logo.png', - contacts: ['ve7jtb@example.org', 'mary@example.org'] -}) -```` ## Advanced usage diff --git a/src/__test__/solid-auth-client.spec.js b/src/__test__/solid-auth-client.spec.js index b63f57d..3e8accc 100644 --- a/src/__test__/solid-auth-client.spec.js +++ b/src/__test__/solid-auth-client.spec.js @@ -195,36 +195,6 @@ describe('login', () => { expect(location.searchParams.get('scope')).toEqual('openid') expect(location.searchParams.get('client_id')).toEqual('the-client-id') }) - - it('performs the client registration the the correct provided registration parameters', async () => { - let requestBody = {} - nock('https://localhost/') - .get('/.well-known/openid-configuration') - .reply(200, oidcConfiguration) - .get('/jwks') - .reply(200, jwks) - .post('/register', body => { - requestBody = body - return true - }) - .reply(200, oidcRegistration) - - await instance.login('https://localhost', { - clientName: 'My Example', - 'clientName#ja-Jpan-JP': 'クライアント名', - logoUri: 'https://client.example.org/logo.png', - contacts: ['ve7jtb@example.org', 'mary@example.org'] - }) - - expect(requestBody).toMatchObject({ - client_name: 'My Example', - 'client_name#ja-Jpan-JP': 'クライアント名', - contacts: ['ve7jtb@example.org', 'mary@example.org'], - logo_uri: 'https://client.example.org/logo.png' - }) - - expect.assertions(1) - }) }) }) diff --git a/src/solid-auth-client.js b/src/solid-auth-client.js index 0989038..5d22639 100644 --- a/src/solid-auth-client.js +++ b/src/solid-auth-client.js @@ -15,9 +15,6 @@ const globalFetch = fetch export type loginOptions = { callbackUri: string, - clientName?: string, - contacts?: Array, - logoUri?: string, popupUri: string, storage: AsyncStorage } diff --git a/src/webid-oidc.js b/src/webid-oidc.js index 71dfa3c..c5bef54 100644 --- a/src/webid-oidc.js +++ b/src/webid-oidc.js @@ -125,34 +125,18 @@ async function storeRp( return rp } -function registerRp(idp: string, opts: loginOptions): Promise { - const { storage, callbackUri } = opts +function registerRp( + idp: string, + { storage, callbackUri }: loginOptions +): Promise { const responseType = 'id_token token' - - const clientNameI18n = {} - Object.entries(opts) - .filter(([key, _]) => key.startsWith('clientName#')) - .forEach( - ([key, value]) => - (clientNameI18n[key.replace('clientName#', 'client_name#')] = value) - ) - - const supplementaryOptions = { - logo_uri: opts.logoUri, - contacts: opts.contacts, - client_name: opts.clientName - } - const registration = { issuer: idp, grant_types: ['implicit'], redirect_uris: [callbackUri], response_types: [responseType], - scope: 'openid profile', - ...clientNameI18n, - ...supplementaryOptions + scope: 'openid profile' } - const options = { defaults: { authenticate: { @@ -162,7 +146,6 @@ function registerRp(idp: string, opts: loginOptions): Promise { }, store: storage } - return RelyingParty.register(idp, registration, options) }