RequestUserAuthorization() public méthode

Prepares a request for user authorization from an authorization server.
public RequestUserAuthorization ( IEnumerable scope = null, Uri returnTo = null ) : void
scope IEnumerable The scope of authorized access requested.
returnTo System.Uri The URL the authorization server should redirect the browser (typically on this site) to when the authorization is completed. If null, the current request's URL will be used.
Résultat void
Exemple #1
0
        /// <summary>
        /// 使用DotNetOpenOAuth组件来模拟授权
        /// </summary>
        /// <returns></returns>
        public ActionResult TestAuthorize()
        {
            var authServer = new AuthorizationServerDescription
            {
                AuthorizationEndpoint = new Uri("http://localhost:3335/OAuth/Authorize"),
                TokenEndpoint         = new Uri("http://localhost:3335/OAuth/Token")
            };

            var autoServerClient = new DotNetOpenAuth.OAuth2.WebServerClient(authServer, clientIdentifier: "fNm0EDIXbfuuDowUpAoq5GTEiywV8eg0TpiIVnV8", clientSecret: "clientSecret");

            autoServerClient.RequestUserAuthorization(new string[] { "scope1" }, new Uri("http://localhost:3335/OAuth/GetAccessToken"));
            return(new EmptyResult());
        }