更新web服务器自定义token解析回调
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
abstract class WebServer {
|
||||
static late WebServer _webServer;
|
||||
|
||||
@@ -10,7 +9,8 @@ abstract class WebServer {
|
||||
_webServer = server;
|
||||
}
|
||||
|
||||
void start(int port, {Function? interceptor});
|
||||
void start(int port,
|
||||
{Function? interceptor, TokenResult Function(String?)? tokenCheck});
|
||||
void stop();
|
||||
void addHandler(handler);
|
||||
}
|
||||
@@ -58,9 +58,18 @@ class RequestMapping {
|
||||
final HttpMethod method;
|
||||
final String path;
|
||||
final HttpResponseType responseType;
|
||||
final bool auth;
|
||||
|
||||
const RequestMapping(
|
||||
{this.method = HttpMethod.ALL,
|
||||
required this.path,
|
||||
this.auth = true,
|
||||
this.responseType = HttpResponseType.JSON});
|
||||
}
|
||||
|
||||
class TokenResult {
|
||||
bool status;
|
||||
String? errMsg;
|
||||
Map<String, dynamic>? payload;
|
||||
TokenResult({required this.status, this.errMsg, this.payload});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user