OpenAuth_server/src/api/oauth/index.ts

64 lines
1.7 KiB
TypeScript
Raw Normal View History

2018-11-06 19:48:50 +00:00
import { Router } from "express";
2020-03-17 15:27:57 +00:00
import GetAuthRoute from "./auth";
2019-03-13 01:06:09 +00:00
import JWTRoute from "./jwt";
import Public from "./public";
import RefreshTokenRoute from "./refresh";
2018-11-06 19:48:50 +00:00
const OAuthRoue: Router = Router();
2019-03-14 22:10:39 +00:00
/**
* @api {post} /oauth/auth
* @apiName OAuthAuth
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiGroup oauth
* @apiPermission user Special required
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiParam {String} response_type must be "code" others are not supported
* @apiParam {String} client_id ClientID
* @apiParam {String} redirect_uri The URI to redirect with code
* @apiParam {String} scope Scope that contains the requested permissions (comma seperated list of permissions)
* @apiParam {String} state State, that will be passed to redirect_uri for client
* @apiParam {String} nored Deactivates the Redirect response from server and instead returns the redirect URI in JSON response
*/
2020-03-17 15:27:57 +00:00
OAuthRoue.post("/auth", GetAuthRoute(false));
2019-03-14 22:10:39 +00:00
/**
* @api {get} /oauth/jwt
* @apiName OAuthJwt
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiGroup oauth
* @apiPermission none
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiParam {String} refreshtoken
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiSuccess {String} token The JWT that allowes the application to access the recources granted for refresh token
*/
2020-08-07 14:16:39 +00:00
OAuthRoue.get("/jwt", JWTRoute);
2019-03-14 22:10:39 +00:00
/**
* @api {get} /oauth/public
* @apiName OAuthPublic
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiGroup oauth
* @apiPermission none
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiSuccess {String} public_key The applications public_key. Used to verify JWT.
*/
2020-08-07 14:16:39 +00:00
OAuthRoue.get("/public", Public);
2019-03-14 22:10:39 +00:00
/**
* @api {get} /oauth/refresh
* @apiName OAuthRefreshGet
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiGroup oauth
*/
2018-11-06 19:48:50 +00:00
OAuthRoue.get("/refresh", RefreshTokenRoute);
2019-03-14 22:10:39 +00:00
/**
* @api {post} /oauth/refresh
* @apiName OAuthRefreshPost
2020-08-07 14:16:39 +00:00
*
2019-03-14 22:10:39 +00:00
* @apiGroup oauth
*/
2018-11-06 19:48:50 +00:00
OAuthRoue.post("/refresh", RefreshTokenRoute);
2020-03-17 15:27:57 +00:00
export default OAuthRoue;