This commit is contained in:
msyu
2024-10-23 11:17:42 +03:00
commit ab5c944862
380 changed files with 55823 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
component
extends="taffy.core.resource"
taffy_uri="/authenticate" {
public function post(username, password, deviceId) {
//implementation of verifying the username/password are up to you...
var authSuccess = authenticate(username, password);
if (!authSuccess){
return noData().withStatus(401, "Not Authorized");
}
//create a new device token:
var deviceToken = createUUID();
//saving the device token to the database is up to you...
saveDeviceToken(username, deviceId, deviceToken);
//tell the device auth was successful and give it the device token
return representationOf({ token: deviceToken }).withStatus(200, "OK");
}
private function authenticate(username, password){ return true; }
private function saveDeviceToken(username, deviceId, deviceToken){}
}