Esempio n. 1
0
        /// <summary>
        /// Revoke authentication token
        /// </summary>
        /// <param name="param">Revoke Auth Request Model</param>
        /// <remarks></remarks>
        public RevokeAuthResultModel RevokeAuth(RevokeAuthRequestModel param)
        {
            RevokeAuthResultModel result = new RevokeAuthResultModel();

            try
            {
                MemberBL bl = new MemberBL();

                var member = bl.GetTokenOwner(new TokenModel {
                    Token = param.AccessToken
                });
                var token = IdentityHelper.GenerateToken(member);

                bl.RegisterToken(token);

                result.AccessToken = token.Token;
                result.Status      = true;
                result.Message     = "Revoke authentication successfully.";
            }
            catch (OrgException oex)
            {
                result.Status  = false;
                result.Message = oex.Message;
            }
            catch (Exception ex)
            {
                result.Status  = false;
                result.Message = AppConfigs.InternalErrorMessage;

                if (AppConfigs.DebugInternalMessage)
                {
                    result.InternalMessage = ex.Message;
                }
            }

            return(result);
        }