Beispiel #1
0
        protected IToken GetToken(Connection connection)
        {
            var guid = GetGuidFromAuthHeader(WebOperationContext.Current);

            var token = connection.UserService.GetToken(guid);
            if (token == null) throw new JsonError(JsonResponseCode.InvalidToken).GetException();
            return token;
        }
Beispiel #2
0
        protected IUser GetFriend(Connection connection, IToken token, string username)
        {
            CheckNull(username, "username");
            var friend = GetUser(connection, token, username);
            var success = (friend != null && connection.FriendService.HasAccessToUserDetails(token, friend));

            if (!success)
                throw new JsonError(JsonResponseCode.UserNotFriendly).GetException();

            return friend;
        }
Beispiel #3
0
 protected IUser GetUser(Connection connection, IToken token, string username)
 {
     CheckNull(username, "username");
     return connection.UserService.GetUser(token, username);
 }