mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Correctly render internal IDP errors
This commit is contained in:
parent
3a0cf60a55
commit
c18b8526cc
@ -84,6 +84,8 @@ export class IdentityProviderFactory {
|
|||||||
},
|
},
|
||||||
renderError:
|
renderError:
|
||||||
async(ctx: KoaContextWithOIDC, out: ErrorOut, error: Error): Promise<void> => {
|
async(ctx: KoaContextWithOIDC, out: ErrorOut, error: Error): Promise<void> => {
|
||||||
|
// This allows us to stream directly to to the response object, see https://github.com/koajs/koa/issues/944
|
||||||
|
ctx.respond = false;
|
||||||
const preferences: RepresentationPreferences = { type: { 'text/plain': 1 }};
|
const preferences: RepresentationPreferences = { type: { 'text/plain': 1 }};
|
||||||
const result = await this.errorHandler.handleSafe({ error, preferences });
|
const result = await this.errorHandler.handleSafe({ error, preferences });
|
||||||
await this.responseWriter.handleSafe({ response: ctx.res, result });
|
await this.responseWriter.handleSafe({ response: ctx.res, result });
|
||||||
|
@ -335,13 +335,20 @@ describe('A Solid server with IDP', (): void => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('openid-configuration', (): void => {
|
describe('setup', (): void => {
|
||||||
it('should contain solid_oidc_supported key.', async(): Promise<void> => {
|
it('should contain the required configuration keys.', async(): Promise<void> => {
|
||||||
const res = await fetch(`${baseUrl}.well-known/openid-configuration`);
|
const res = await fetch(`${baseUrl}.well-known/openid-configuration`);
|
||||||
const jsonBody = await res.json();
|
const jsonBody = await res.json();
|
||||||
|
|
||||||
expect(res.status).toBe(200);
|
expect(res.status).toBe(200);
|
||||||
|
// https://solid.github.io/authentication-panel/solid-oidc/#discovery
|
||||||
expect(jsonBody.solid_oidc_supported).toEqual('https://solidproject.org/TR/solid-oidc');
|
expect(jsonBody.solid_oidc_supported).toEqual('https://solidproject.org/TR/solid-oidc');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return correct error output.', async(): Promise<void> => {
|
||||||
|
const res = await fetch(`${baseUrl}idp/auth`);
|
||||||
|
expect(res.status).toBe(400);
|
||||||
|
await expect(res.text()).resolves.toContain('InvalidRequest: invalid_request');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user