feat: demo application
This commit is contained in:
1 parent
e12694bf0a
commit
355aab7f6f
13 files changed
+1494
-569
No files matched your search
+21
-6
@@ -1,12 +1,27 @@
|
||||
import connect from 'express-openid-connect';
|
||||
import express from 'express';
|
||||
|
||||
export * from './routes.js';
|
||||
const app = express();
|
||||
|
||||
export * from './auth.js';
|
||||
app.use( connect.auth( {
|
||||
'authRequired': false,
|
||||
'issuerBaseURL': process.env.OIDC_ISSUER,
|
||||
'clientID': process.env.OIDC_CLIENT_ID,
|
||||
'clientSecret': process.env.OIDC_CLIENT_SECRET,
|
||||
'secret': process.env.SIGNING_SECRET,
|
||||
'baseURL': process.env.APP_BASE_URL,
|
||||
'authorizationParams': {
|
||||
'scope': 'openid profile email',
|
||||
'response_type': 'code'
|
||||
}
|
||||
} ) );
|
||||
|
||||
export type * from './dtype.d.ts';
|
||||
app.get( '/', ( _request, response ) => {
|
||||
response.send( 'Hello World' );
|
||||
} );
|
||||
|
||||
app.get( '/account', connect.requiresAuth(), ( request, response ) => {
|
||||
response.send( 'Account' );
|
||||
} );
|
||||
|
||||
export const getUserId = ( request: express.Request ): string | undefined => {
|
||||
return request.user?.id;
|
||||
};
|
||||
app.listen( 8080 );
|
||||
Reference in new issue
Block a user