fix: Auth endpoints in docs
This commit is contained in:
		
							parent
							
								
									fef714b870
								
							
						
					
					
						commit
						5a9f1ea2f1
					
				
					 3 changed files with 66 additions and 12 deletions
				
			
		|  | @ -8,22 +8,24 @@ const router = express.Router(); | |||
| router.get('/config', handleGetFrontendAuthConfig); | ||||
| 
 | ||||
| router.get('/testAuthenticatedOnly', authenticatedOnly, (_req, res) => { | ||||
|     /* #swagger.security = [{ "student": [ ] }, { "teacher": [ ] }] */ | ||||
|     /* #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */ | ||||
|     res.json({ message: 'If you see this, you should be authenticated!' }); | ||||
| }); | ||||
| 
 | ||||
| router.get('/testStudentsOnly', studentsOnly, (_req, res) => { | ||||
|     /* #swagger.security = [{ "student": [ ] }] */ | ||||
|     /* #swagger.security = [{ "studentProduction": [ ] }, { "studentStaging": [ ] }, { "studentDev": [ ] }] */ | ||||
|     res.json({ message: 'If you see this, you should be a student!' }); | ||||
| }); | ||||
| 
 | ||||
| router.get('/testTeachersOnly', teachersOnly, (_req, res) => { | ||||
|     /* #swagger.security = [{ "teacher": [ ] }] */ | ||||
|     /* #swagger.security = [{ { "teacherProduction": [ ] }, { "teacherStaging": [ ] }, { "teacherDev": [ ] }] */ | ||||
|     res.json({ message: 'If you see this, you should be a teacher!' }); | ||||
| }); | ||||
| 
 | ||||
| // This endpoint is called by the client when the user has just logged in.
 | ||||
| // It creates or updates the user entity based on the authentication data the endpoint was called with.
 | ||||
| router.post('/hello', authenticatedOnly, postHelloHandler); | ||||
| router.post('/hello', authenticatedOnly, /* | ||||
|     #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] | ||||
| */ postHelloHandler ); | ||||
| 
 | ||||
| export default router; | ||||
|  |  | |||
|  | @ -18,12 +18,12 @@ router.get('/', (_, res: Response) => { | |||
|     }); | ||||
| }); | ||||
| 
 | ||||
| router.use('/student', studentRouter /* #swagger.tags = ['Student'] */); | ||||
| router.use('/teacher', teacherRouter /* #swagger.tags = ['Teacher'] */); | ||||
| router.use('/class', classRouter /* #swagger.tags = ['Class'] */); | ||||
| router.use('/auth', authRouter /* #swagger.tags = ['Auth'] */); | ||||
| router.use('/theme', themeRoutes /* #swagger.tags = ['Theme'] */); | ||||
| router.use('/learningPath', learningPathRoutes /* #swagger.tags = ['Learning Path'] */); | ||||
| router.use('/learningObject', learningObjectRoutes /* #swagger.tags = ['Learning Object'] */); | ||||
| router.use('/class', classRouter /* #swagger.tags = ['Class'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ||||
| router.use('/learningObject', learningObjectRoutes /* #swagger.tags = ['Learning Object'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ||||
| router.use('/learningPath', learningPathRoutes /* #swagger.tags = ['Learning Path'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ||||
| router.use('/student', studentRouter /* #swagger.tags = ['Student'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ||||
| router.use('/teacher', teacherRouter /* #swagger.tags = ['Teacher'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ||||
| router.use('/theme', themeRoutes /* #swagger.tags = ['Theme'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */); | ||||
| 
 | ||||
| export default router; | ||||
|  |  | |||
|  | @ -26,7 +26,59 @@ const doc = { | |||
|     ], | ||||
|     components: { | ||||
|         securitySchemes: { | ||||
|             student: { | ||||
|             studentDev: { | ||||
|                 type: 'oauth2', | ||||
|                 flows: { | ||||
|                     implicit: { | ||||
|                         authorizationUrl: 'http://localhost:7080/realms/student/protocol/openid-connect/auth', | ||||
|                         scopes: { | ||||
|                             openid: 'openid', | ||||
|                             profile: 'profile', | ||||
|                             email: 'email', | ||||
|                         }, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             teacherDev: { | ||||
|                 type: 'oauth2', | ||||
|                 flows: { | ||||
|                     implicit: { | ||||
|                         authorizationUrl: 'http://localhost:7080/realms/teacher/protocol/openid-connect/auth', | ||||
|                         scopes: { | ||||
|                             openid: 'openid', | ||||
|                             profile: 'profile', | ||||
|                             email: 'email', | ||||
|                         }, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             studentStaging: { | ||||
|                 type: 'oauth2', | ||||
|                 flows: { | ||||
|                     implicit: { | ||||
|                         authorizationUrl: 'http://localhost/idp/realms/student/protocol/openid-connect/auth', | ||||
|                         scopes: { | ||||
|                             openid: 'openid', | ||||
|                             profile: 'profile', | ||||
|                             email: 'email', | ||||
|                         }, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             teacherStaging: { | ||||
|                 type: 'oauth2', | ||||
|                 flows: { | ||||
|                     implicit: { | ||||
|                         authorizationUrl: 'http://localhost/idp/realms/teacher/protocol/openid-connect/auth', | ||||
|                         scopes: { | ||||
|                             openid: 'openid', | ||||
|                             profile: 'profile', | ||||
|                             email: 'email', | ||||
|                         }, | ||||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             studentProduction: { | ||||
|                 type: 'oauth2', | ||||
|                 flows: { | ||||
|                     implicit: { | ||||
|  | @ -39,7 +91,7 @@ const doc = { | |||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             teacher: { | ||||
|             teacherProduction: { | ||||
|                 type: 'oauth2', | ||||
|                 flows: { | ||||
|                     implicit: { | ||||
|  |  | |||
		Reference in a new issue