class TokenOwnerAuthzModule implements CrestAuthorizationModule {

    @Override
    public Promise<AuthorizationResult, ResourceException> authorizeAction(Context context, ActionRequest request) {

        try {
            if (actionCanBeInvokedBySelf(request.getAction()) && isTokenOwner(context, request)) {
                return Promises.newResultPromise(AuthorizationResult.accessPermitted());
            }
        } catch (ResourceException e) {
            return e.asPromise();
        } catch (SSOException e) {
            return new ForbiddenException().asPromise();
        }

        return new ForbiddenException().asPromise();
    }

    public  TokenOwnerAuthzModule(String tokenId, SSOTokenManager ssoTokenManager, String... allowedActions);

}