Search in sources :

Example 1 with ApiInvokeException

use of com.rebuild.api.ApiInvokeException in project rebuild by getrebuild.

the class PageTokenVerify method execute.

@Override
public JSON execute(ApiContext context) throws ApiInvokeException {
    String token = context.getParameterNotBlank("token");
    ID tokenUser = verify(token);
    if (tokenUser == null) {
        throw new ApiInvokeException("Invalid token : " + token);
    }
    User user = Application.getUserStore().getUser(tokenUser);
    JSON ret = JSONUtils.toJSONObject(new String[] { "user_id", "login_name", "full_name" }, new Object[] { user.getId(), user.getName(), user.getFullName() });
    return formatSuccess(ret);
}
Also used : User(com.rebuild.core.privileges.bizz.User) ApiInvokeException(com.rebuild.api.ApiInvokeException) JSON(com.alibaba.fastjson.JSON) ID(cn.devezhao.persist4j.engine.ID) UUID(java.util.UUID)

Aggregations

ID (cn.devezhao.persist4j.engine.ID)1 JSON (com.alibaba.fastjson.JSON)1 ApiInvokeException (com.rebuild.api.ApiInvokeException)1 User (com.rebuild.core.privileges.bizz.User)1 UUID (java.util.UUID)1