public virtual void Parse(HttpRequestBase request) { ClientId = MessageUtility.GetInt32(request, Protocal.CLIENT_ID);; RedirectUri = new Uri(MessageUtility.GetString(request, Protocal.REDIRECT_URI)); State = MessageUtility.TryGetString(request, Protocal.STATE); Scope = MessageUtility.TryGetString(request, Protocal.SCOPE); PlatCode = MessageUtility.GetInt64(request, "platcode"); Browser = MessageUtility.TryGetString(request, "browser"); IpAddress = MessageUtility.TryGetString(request, "ipaddress"); ExtendField = MessageUtility.TryGetString(request, "extendfield"); }
public ServerAccessGrant TryGetToken(HttpContextBase context) { Arguments.NotNull(context, "context"); var accessToken = MessageUtility.ParseAccessToken(context.Request); if (!String.IsNullOrEmpty(accessToken)) { return(GetServerAccessGrant(accessToken)); } return(null); }
public static string GetAccessToken(HttpRequestBase request) { var accessToken = MessageUtility.TryGetString(request, Protocal.ACCESS_TOKEN); if (String.IsNullOrEmpty(accessToken)) { accessToken = MessageUtility.TryGetString(request, Protocal.ACCESSTOKEN); } if (String.IsNullOrEmpty(accessToken)) { throw new OAuthException(AccessTokenRequestErrorCode.InvalidRequest, Protocal.ACCESS_TOKEN, 400); } return(accessToken); }
public void Parse(HttpRequestBase request) { ClientId = MessageUtility.GetInt32(request, Protocal.CLIENT_ID); AuthResponseType responseType; if (!AuthResponseTypeExtend.TryParse(MessageUtility.GetString(request, Protocal.RESPONSE_TYPE), out responseType)) { throw new OAuthException(AuthRequestErrorCode.UnsupportedResponseType, "invalid response type", 400); } RedirectUri = new Uri(MessageUtility.GetString(request, Protocal.REDIRECT_URI)); State = MessageUtility.TryGetString(request, Protocal.STATE); Scope = MessageUtility.TryGetString(request, Protocal.SCOPE); PlatCode = MessageUtility.GetInt64(request, "platcode"); ExtendField = MessageUtility.TryGetString(request, "extendfield"); }
public override void Parse(HttpRequestBase request) { base.Parse(request); PlatCode = MessageUtility.GetInt64(request, "platcode"); Browser = MessageUtility.TryGetString(request, "browser"); IpAddress = MessageUtility.TryGetString(request, "ipaddress"); ExtendField = MessageUtility.TryGetString(request, "extendfield"); if (String.IsNullOrEmpty(Browser)) { Browser = GetBrowser(request); } if (String.IsNullOrEmpty(IpAddress)) { IpAddress = Projects.Tool.Http.IpAddress.GetIP(); } }
public AuthCodeRequest Authorize(HttpContextBase context) { Arguments.NotNull(context, "context"); var codeRequest = MessageUtility.ParseAuthCodeRequest(context.Request); var client = GetClientAuth(codeRequest.ClientId); if (client == null) { OAuthError(AccessTokenRequestErrorCode.InvoidClient, "client id invalid."); } if (client.Status != ClientAuthStatus.Enabled) { OAuthError(AccessTokenRequestErrorCode.UnauthorizedClient, "client unauthorized", 401); } client.ValidateCallbackUri(codeRequest.RedirectUri); return(codeRequest); }
public virtual void Parse(HttpRequestBase request) { ClientId = MessageUtility.GetInt32(request, Protocal.CLIENT_ID); ClientSecret = MessageUtility.GetString(request, Protocal.CLIENT_SECRET); }
public override void Parse(HttpRequestBase request) { base.Parse(request); Code = MessageUtility.GetString(request, Protocal.CODE); RedirectUri = new Uri(MessageUtility.GetString(request, Protocal.REDIRECT_URI)); }
public override void Parse(HttpRequestBase request) { base.Parse(request); UserName = MessageUtility.GetString(request, Protocal.USER_NAME); Password = MessageUtility.GetString(request, Protocal.PASSWORD); }