21 lines
525 B
Java
21 lines
525 B
Java
|
package net.frozenorb.apiv3.routes;
|
||
|
|
||
|
import com.google.common.collect.ImmutableMap;
|
||
|
import net.frozenorb.apiv3.actors.Actor;
|
||
|
import spark.Request;
|
||
|
import spark.Response;
|
||
|
import spark.Route;
|
||
|
|
||
|
public final class GETWhoAmI implements Route {
|
||
|
|
||
|
public Object handle(Request req, Response res) {
|
||
|
Actor actor = req.attribute("actor");
|
||
|
|
||
|
return ImmutableMap.of(
|
||
|
"name", actor.getName(),
|
||
|
"type", actor.getType(),
|
||
|
"authorized", actor.isAuthorized()
|
||
|
);
|
||
|
}
|
||
|
|
||
|
}
|