public void StoreUserInformation(User user)
 {
     string reqStr2 = "https://www.box.net/api/1.0/rest?action=get_user_info&api_key=" + api_key + "&auth_token=" + boxProvider.authToken() + "&user_id=" + user.ID + "&params[]=show_collab_items";
     string resp2 = getWebRequest(reqStr2);
     System.Diagnostics.Debug.WriteLine(resp2);
     string resp = resp2.Substring(resp2.IndexOf("<user_name>") + 11, resp2.IndexOf("</user_name>") - resp2.IndexOf("<user_name>") - 11);
     login = resp;
     //login = user.Login;
     email = user.Email;
     spaceAmount = user.SpaceAmount;
     spaceUsed = user.SpaceUsed;
 }
예제 #2
0
 public GetAuthenticationTokenStatus GetAuthenticationToken(string authenticationTicket, out string authenticationToken, out User authenticatedUser);
예제 #3
0
 public AuthenticationStatus AuthenticateUser(string login, string password, string method, out string authenticationToken, out User authenticatedUser);
예제 #4
0
        /// <summary>
        /// Gets authentication token required for communication between Box.NET service and user's application.
        /// Method has to be called after the user has authorized themself on Box.NET site
        /// </summary>
        /// <param name="authenticationTicket">Athentication ticket</param>
        /// <param name="authenticationToken">Authentication token</param>
        /// <param name="authenticatedUser">Authenticated user account information</param>
        /// <returns>Operation result</returns>
        public GetAuthenticationTokenStatus GetAuthenticationToken(
            string authenticationTicket,
            out string authenticationToken,
            out User authenticatedUser)
        {
            SOAPUser user;

            string result = _service.get_auth_token(_apiKey, authenticationTicket, out authenticationToken, out user);

            authenticatedUser = user == null ? null : new User(user);
            _token = authenticationToken;

            return StatusMessageParser.ParseGetAuthenticationTokenStatus(result);
        }
예제 #5
0
 public AuthenticationStatus AuthenticateUser(
     string login,
     string password,
     string method,
     out string authenticationToken,
     out User authenticatedUser)
 {
     throw new NotSupportedException("This method is no longer supported by Box.NET API");
 }
예제 #6
0
        private void GetAuthenticationTokenFinished(object sender, get_auth_tokenCompletedEventArgs e)
        {
            object[] state = (object[]) e.UserState;
            Exception error = null;

            OperationFinished<GetAuthenticationTokenResponse> getAuthenticationTokenCompleted =
                (OperationFinished<GetAuthenticationTokenResponse>) state[0];

            GetAuthenticationTokenStatus status;

            if (e.Error == null)
            {
                status = StatusMessageParser.ParseGetAuthenticationTokenStatus(e.Result);

                if (status == GetAuthenticationTokenStatus.Unknown)
                {
                    error = new UnknownOperationStatusException(e.Result);
                }
            }
            else
            {
                status = GetAuthenticationTokenStatus.Failed;
                error = e.Error;
            }

            GetAuthenticationTokenResponse response = new GetAuthenticationTokenResponse
                                                      	{
                                                      		Status = status,
                                                      		UserState = state[1],
                                                      		Error = error,
                                                            AuthenticationToken = string.Empty
                                                      	};

            if (response.Status == GetAuthenticationTokenStatus.Successful)
            {
                User authenticatedUser = new User(e.user);
                response.AuthenticatedUser = authenticatedUser;
                response.AuthenticationToken = e.auth_token;
                _token = e.auth_token;
            }

            getAuthenticationTokenCompleted(response);
        }