本文整理汇总了C#中DotNetOpenAuth.Messaging.MessageReceivingEndpoint类的典型用法代码示例。如果您正苦于以下问题:C# MessageReceivingEndpoint类的具体用法?C# MessageReceivingEndpoint怎么用?C# MessageReceivingEndpoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MessageReceivingEndpoint类属于DotNetOpenAuth.Messaging命名空间,在下文中一共展示了MessageReceivingEndpoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Get
/// <summary>
/// Method for getting a Site object containing information about the site
/// </summary>
/// <returns></returns>
public Domain.Site Get()
{
// Build request URL
List<string> requestUrlParameters = new List<string>();
// Do the request
MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/site/get", requestUrlParameters), HttpDeliveryMethods.GetRequest);
XPathNavigator responseMessage = _provider.DoRequest(requestMessage);
if (responseMessage == null) return null;
// Get the site id
XPathNavigator siteIdToken = responseMessage.SelectSingleNode("/response/site_id");
if (siteIdToken == null) return null;
// Get the site name
XPathNavigator siteNameToken = responseMessage.SelectSingleNode("/response/site_name");
if (siteNameToken == null) return null;
// Get the product key
XPathNavigator productKeyToken = responseMessage.SelectSingleNode("/response/product_key");
if (productKeyToken == null) return null;
// Get the allow signup variable
XPathNavigator allowSignupToken = responseMessage.SelectSingleNode("/response/allow_signup_p");
if (allowSignupToken == null) return null;
// Get the site key
XPathNavigator siteKeyToken = responseMessage.SelectSingleNode("/response/site_key");
if (siteKeyToken == null) return null;
// Get the license id
XPathNavigator licenseIdToken = responseMessage.SelectSingleNode("/response/license_id");
if (licenseIdToken == null) return null;
// Get the domain
XPathNavigator domainToken = responseMessage.SelectSingleNode("/response/domain");
if (domainToken == null) return null;
// Create result
try
{
Domain.Site result = new Domain.Site
{
SiteId = Helpers.ConvertStringToInteger(siteIdToken.Value),
SiteName = siteNameToken.Value,
SiteKey = siteKeyToken.Value,
ProductKey = productKeyToken.Value,
AllowSignup = (allowSignupToken.Value != "f"),
LicenseId = Helpers.ConvertStringToInteger(licenseIdToken.Value),
Domain = domainToken.Value
};
return result;
}
catch
{
return null;
}
}
开发者ID:23,项目名称:23-api-dotnet,代码行数:64,代码来源:SiteService.cs
示例2: getData_Click
protected void getData_Click(object sender, EventArgs e)
{
WebConsumer consumer = CreateConsumer();
var serviceEndpoint = new MessageReceivingEndpoint(serviceTextBox.Text, HttpDeliveryMethods.GetRequest);
var accessToken = Session["WcfAccessToken"] as string;
if (accessToken == null)
{
throw new InvalidOperationException("No access token!");
}
httpRequest = consumer.PrepareAuthorizedRequest(serviceEndpoint, accessToken);
//httpRequest.BeginGetResponse(new AsyncCallback(GetResponse), null);
var response = httpRequest.GetResponse();
using (var stream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(stream))
{
String data = reader.ReadToEnd();
JavaScriptSerializer js = new JavaScriptSerializer();
var dataObject = js.Deserialize<dynamic>(data);
for (int i = 0; i < dataObject.Length; i++)
{
accountListBox.Items.Add(String.Format("{0} - {1} - {2} - {3}", dataObject[i]["Name"], dataObject[i]["Iban"], dataObject[i]["Balance"], dataObject[i]["Currency"]));
}
dataLabel.Text = data;
}
}
}
开发者ID:bmegias,项目名称:OAuthPoc,代码行数:30,代码来源:Default.aspx.cs
示例3: OAuthManager
public OAuthManager(IHttpListenerManager listenerManager, DesktopConsumer consumer,
MessageReceivingEndpoint serviceEndPoint)
{
_listenerManager = listenerManager;
_consumer = consumer;
_serviceEndPoint = serviceEndPoint;
}
开发者ID:flickr-downloadr,项目名称:flickr-downloadr,代码行数:7,代码来源:OAuthManager.cs
示例4: Create
// * Create user
// Implements http://www.23developer.com/api/user-create
/// <summary>Create a user specified by an e-mail address, username, password, full name, timezone and site admin rigts specification</summary>
public int? Create(string email, string username = null, string password = null, string fullName = null, Timezone timezone = Timezone.CET, bool siteAdmin = false)
{
// Verify required parameters
if (String.IsNullOrEmpty(email)) return null;
// Build request URL
List<string> requestUrlParameters = new List<string>();
requestUrlParameters.Add("email=" + HttpUtility.UrlEncode(email));
if (!String.IsNullOrEmpty(username)) requestUrlParameters.Add("username=" + HttpUtility.UrlEncode(username));
if (!String.IsNullOrEmpty(password)) requestUrlParameters.Add("password=" + HttpUtility.UrlEncode(password));
if (!String.IsNullOrEmpty(fullName)) requestUrlParameters.Add("full_name=" + HttpUtility.UrlEncode(fullName));
requestUrlParameters.Add("timezone=" + HttpUtility.UrlEncode(RequestValues.Get(timezone)));
if (siteAdmin) requestUrlParameters.Add("site_admin=1");
// Do the request
MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/user/create", requestUrlParameters), HttpDeliveryMethods.GetRequest);
XPathNavigator responseMessage = _provider.DoRequest(requestMessage);
if (responseMessage == null) return null;
// Get the User id
XPathNodeIterator users = responseMessage.Select("/response/user_id");
if ((users.MoveNext()) && (users.Current != null)) return Helpers.ConvertStringToInteger(users.Current.Value);
// If nothing pops up, we'll return null
return null;
}
开发者ID:denno-secqtinstien,项目名称:23-api-dotnet,代码行数:31,代码来源:UserService.cs
示例5: Create
// * Create album
// Implements http://www.23developer.com/api/album-create
public int? Create(string title, string description = "", bool hide = false, int? userId = null)
{
// Verify required parameters
if (String.IsNullOrEmpty(title)) return null;
// Build request URL
List<string> requestUrlParameters = new List<string>();
requestUrlParameters.Add("title=" + HttpUtility.UrlEncode(title));
if (!String.IsNullOrEmpty(description)) requestUrlParameters.Add("description=" + HttpUtility.UrlEncode(description));
if (hide) requestUrlParameters.Add("hide_p=1");
if (userId != null) requestUrlParameters.Add("user_id=" + userId);
// Do the request
MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/album/create", requestUrlParameters), HttpDeliveryMethods.GetRequest);
XPathNavigator responseMessage = _provider.DoRequest(requestMessage);
if (responseMessage == null) return null;
// Get the album id
XPathNodeIterator albums = responseMessage.Select("/response/album_id");
if ((albums.MoveNext()) && (albums.Current != null)) return Helpers.ConvertStringToInteger(albums.Current.Value);
// If nothing pops up, we'll return null
return null;
}
开发者ID:23,项目名称:23-api-dotnet,代码行数:28,代码来源:AlbumService.cs
示例6: SignedMessageBase
/// <summary>
/// Initializes a new instance of the <see cref="SignedMessageBase"/> class.
/// </summary>
/// <param name="transport">A value indicating whether this message requires a direct or indirect transport.</param>
/// <param name="recipient">The URI that a directed message will be delivered to.</param>
internal SignedMessageBase(MessageTransport transport, MessageReceivingEndpoint recipient)
: base(MessageProtections.All, transport, recipient)
{
ITamperResistantOAuthMessage self = (ITamperResistantOAuthMessage)this;
HttpDeliveryMethods methods = ((IDirectedProtocolMessage)this).HttpMethods;
self.HttpMethod = (methods & HttpDeliveryMethods.PostRequest) != 0 ? "POST" : "GET";
}
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:12,代码来源:SignedMessageBase.cs
示例7: SignedMessageBase
/// <summary>
/// Initializes a new instance of the <see cref="SignedMessageBase"/> class.
/// </summary>
/// <param name="transport">A value indicating whether this message requires a direct or indirect transport.</param>
/// <param name="recipient">The URI that a directed message will be delivered to.</param>
/// <param name="version">The OAuth version.</param>
internal SignedMessageBase(MessageTransport transport, MessageReceivingEndpoint recipient, Version version)
: base(MessageProtections.All, transport, recipient, version)
{
ITamperResistantOAuthMessage self = (ITamperResistantOAuthMessage)this;
HttpDeliveryMethods methods = ((IDirectedProtocolMessage)this).HttpMethods;
self.HttpMethod = MessagingUtilities.GetHttpVerb(methods);
}
开发者ID:jcp-xx,项目名称:dotnetopenid,代码行数:13,代码来源:SignedMessageBase.cs
示例8: VerifyAuthenticationCore
protected override AuthenticationResult VerifyAuthenticationCore(AuthorizedTokenResponse response) {
// See here for Field Selectors API http://developer.linkedin.com/docs/DOC-1014
const string profileRequestUrl =
"http://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,industry,summary)";
string accessToken = response.AccessToken;
var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl, HttpDeliveryMethods.GetRequest);
HttpWebRequest request = this.WebWorker.PrepareAuthorizedRequest(profileEndpoint, accessToken);
try {
using (WebResponse profileResponse = request.GetResponse()) {
using (Stream responseStream = profileResponse.GetResponseStream()) {
XDocument document = XDocument.Load(responseStream);
string userId = document.Root.Element("id").Value;
string firstName = document.Root.Element("first-name").Value;
string lastName = document.Root.Element("last-name").Value;
string userName = firstName + " " + lastName;
var extraData = new Dictionary<string, string>();
extraData.Add("accesstoken", accessToken);
extraData.Add("name", userName);
extraData.AddDataIfNotEmpty(document, "headline");
extraData.AddDataIfNotEmpty(document, "summary");
extraData.AddDataIfNotEmpty(document, "industry");
return new AuthenticationResult(
isSuccessful: true, provider: this.ProviderName, providerUserId: userId, userName: userName, extraData: extraData);
}
}
} catch (Exception exception) {
return new AuthenticationResult(exception);
}
}
开发者ID:vonbv,项目名称:dotnetopenid,代码行数:35,代码来源:LinkedInClient.cs
示例9: GetNewRequestMessage
/// <summary>
/// Analyzes an incoming request message payload to discover what kind of
/// message is embedded in it and returns the type, or null if no match is found.
/// </summary>
/// <param name="recipient">The intended or actual recipient of the request message.</param>
/// <param name="fields">The name/value pairs that make up the message payload.</param>
/// <returns>
/// A newly instantiated <see cref="IProtocolMessage"/>-derived object that this message can
/// deserialize to. Null if the request isn't recognized as a valid protocol message.
/// </returns>
/// <remarks>
/// The request messages are:
/// UnauthorizedTokenRequest
/// AuthorizedTokenRequest
/// UserAuthorizationRequest
/// AccessProtectedResourceRequest
/// </remarks>
public virtual IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields)
{
ErrorUtilities.VerifyArgumentNotNull(recipient, "recipient");
ErrorUtilities.VerifyArgumentNotNull(fields, "fields");
MessageBase message = null;
if (fields.ContainsKey("oauth_consumer_key") &&
!fields.ContainsKey("oauth_token")) {
message = new UnauthorizedTokenRequest(recipient);
} else if (fields.ContainsKey("oauth_consumer_key") &&
fields.ContainsKey("oauth_token")) {
// Discern between RequestAccessToken and AccessProtectedResources,
// which have all the same parameters, by figuring out what type of token
// is in the token parameter.
bool tokenTypeIsAccessToken = this.tokenManager.GetTokenType(fields["oauth_token"]) == TokenType.AccessToken;
message = tokenTypeIsAccessToken ? (MessageBase)new AccessProtectedResourceRequest(recipient) :
new AuthorizedTokenRequest(recipient);
} else {
// fail over to the message with no required fields at all.
message = new UserAuthorizationRequest(recipient);
}
if (message != null) {
message.SetAsIncoming();
}
return message;
}
开发者ID:vrushalid,项目名称:dotnetopenid,代码行数:47,代码来源:OAuthServiceProviderMessageFactory.cs
示例10: GetList
/// <summary>
/// Get a list of players defined by the default request parameters
/// </summary>
/// <returns></returns>
public List<Domain.Player> GetList()
{
// Build request URL
List<string> requestUrlParameters = new List<string>();
// Do the request
MessageReceivingEndpoint requestMessage = new MessageReceivingEndpoint(_provider.GetRequestUrl("/api/player/list", requestUrlParameters), HttpDeliveryMethods.GetRequest);
XPathNavigator responseMessage = _provider.DoRequest(requestMessage);
if (responseMessage == null) return null;
// List all the videos
XPathNodeIterator players = responseMessage.Select("/response/player");
List<Domain.Player> result = new List<Domain.Player>();
while (players.MoveNext())
{
if (players.Current == null) return null;
// Create the domain Tag
Domain.Player playerModel = new Domain.Player
{
Default = (players.Current.GetAttribute("default_p", "") == "1"),
Name = players.Current.GetAttribute("player_name", ""),
Id = players.Current.GetAttribute("player_id", "")
};
result.Add(playerModel);
}
return result;
}
开发者ID:23,项目名称:23-api-dotnet,代码行数:36,代码来源:PlayerService.cs
示例11: VerifyAuthenticationCore
protected override AuthenticationResult VerifyAuthenticationCore(AuthorizedTokenResponse response) {
string accessToken = response.AccessToken;
string userId = response.ExtraData["user_id"];
string userName = response.ExtraData["screen_name"];
var profileRequestUrl = new Uri("http://api.twitter.com/1/users/show.xml?user_id="
+ MessagingUtilities.EscapeUriDataStringRfc3986(userId));
var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl, HttpDeliveryMethods.GetRequest);
HttpWebRequest request = this.WebWorker.PrepareAuthorizedRequest(profileEndpoint, accessToken);
var extraData = new Dictionary<string, string>();
extraData.Add("accesstoken", accessToken);
try {
using (WebResponse profileResponse = request.GetResponse()) {
using (Stream responseStream = profileResponse.GetResponseStream()) {
XDocument document = XDocument.Load(responseStream);
extraData.AddDataIfNotEmpty(document, "name");
extraData.AddDataIfNotEmpty(document, "location");
extraData.AddDataIfNotEmpty(document, "description");
extraData.AddDataIfNotEmpty(document, "url");
}
}
} catch (Exception) {
// At this point, the authentication is already successful.
// Here we are just trying to get additional data if we can.
// If it fails, no problem.
}
return new AuthenticationResult(
isSuccessful: true, provider: this.ProviderName, providerUserId: userId, userName: userName, extraData: extraData);
}
开发者ID:raelyard,项目名称:dotnetopenid,代码行数:31,代码来源:TwitterClient.cs
示例12: CoordinatingHttpRequestInfo
/// <summary>
/// Initializes a new instance of the <see cref="CoordinatingHttpRequestInfo"/> class
/// that will generate a message when the <see cref="Message"/> property getter is called.
/// </summary>
/// <param name="channel">The channel.</param>
/// <param name="messageFactory">The message factory.</param>
/// <param name="messageData">The message data.</param>
/// <param name="recipient">The recipient.</param>
internal CoordinatingHttpRequestInfo(Channel channel, IMessageFactory messageFactory, IDictionary<string, string> messageData, MessageReceivingEndpoint recipient)
: this(recipient) {
Contract.Requires(channel != null);
Contract.Requires(messageFactory != null);
Contract.Requires(messageData != null);
this.channel = channel;
this.messageFactory = messageFactory;
this.messageData = messageData;
}
开发者ID:SachiraChin,项目名称:dotnetopenid,代码行数:17,代码来源:CoordinatingHttpRequestInfo.cs
示例13: MessageBase
/// <summary>
/// Initializes a new instance of the <see cref="MessageBase"/> class for direct requests or indirect messages.
/// </summary>
/// <param name="protectionRequired">The level of protection the message requires.</param>
/// <param name="transport">A value indicating whether this message requires a direct or indirect transport.</param>
/// <param name="recipient">The URI that a directed message will be delivered to.</param>
/// <param name="version">The OAuth version.</param>
protected MessageBase(MessageProtections protectionRequired, MessageTransport transport, MessageReceivingEndpoint recipient, Version version) {
Requires.NotNull(recipient, "recipient");
Requires.NotNull(version, "version");
this.protectionRequired = protectionRequired;
this.transport = transport;
this.recipient = recipient;
this.Version = version;
}
开发者ID:rafek,项目名称:dotnetopenid,代码行数:16,代码来源:MessageBase.cs
示例14: GetNewRequestMessage
/// <summary>
/// Analyzes an incoming request message payload to discover what kind of
/// message is embedded in it and returns the type, or null if no match is found.
/// </summary>
/// <param name="recipient">The intended or actual recipient of the request message.</param>
/// <param name="fields">The name/value pairs that make up the message payload.</param>
/// <returns>
/// A newly instantiated <see cref="IProtocolMessage"/>-derived object that this message can
/// deserialize to. Null if the request isn't recognized as a valid protocol message.
/// </returns>
public IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields)
{
ErrorUtilities.VerifyArgumentNotNull(recipient, "recipient");
ErrorUtilities.VerifyArgumentNotNull(fields, "fields");
RequestBase message = null;
// Discern the OpenID version of the message.
Protocol protocol = Protocol.V11;
string ns;
if (fields.TryGetValue(Protocol.V20.openid.ns, out ns)) {
ErrorUtilities.VerifyProtocol(string.Equals(ns, Protocol.OpenId2Namespace, StringComparison.Ordinal), MessagingStrings.UnexpectedMessagePartValue, Protocol.V20.openid.ns, ns);
protocol = Protocol.V20;
}
string mode;
if (fields.TryGetValue(protocol.openid.mode, out mode)) {
if (string.Equals(mode, protocol.Args.Mode.associate)) {
if (fields.ContainsKey(protocol.openid.dh_consumer_public)) {
message = new AssociateDiffieHellmanRequest(protocol.Version, recipient.Location);
} else {
message = new AssociateUnencryptedRequest(protocol.Version, recipient.Location);
}
} else if (string.Equals(mode, protocol.Args.Mode.checkid_setup) ||
string.Equals(mode, protocol.Args.Mode.checkid_immediate)) {
AuthenticationRequestMode authMode = string.Equals(mode, protocol.Args.Mode.checkid_immediate) ? AuthenticationRequestMode.Immediate : AuthenticationRequestMode.Setup;
if (fields.ContainsKey(protocol.openid.identity)) {
message = new CheckIdRequest(protocol.Version, recipient.Location, authMode);
} else {
ErrorUtilities.VerifyProtocol(!fields.ContainsKey(protocol.openid.claimed_id), OpenIdStrings.IdentityAndClaimedIdentifierMustBeBothPresentOrAbsent);
message = new SignedResponseRequest(protocol.Version, recipient.Location, authMode);
}
} else if (string.Equals(mode, protocol.Args.Mode.cancel) ||
(string.Equals(mode, protocol.Args.Mode.setup_needed) && (protocol.Version.Major >= 2 || fields.ContainsKey(protocol.openid.user_setup_url)))) {
message = new NegativeAssertionResponse(protocol.Version, recipient.Location, mode);
} else if (string.Equals(mode, protocol.Args.Mode.id_res)) {
if (fields.ContainsKey(protocol.openid.identity)) {
message = new PositiveAssertionResponse(protocol.Version, recipient.Location);
} else {
ErrorUtilities.VerifyProtocol(!fields.ContainsKey(protocol.openid.claimed_id), OpenIdStrings.IdentityAndClaimedIdentifierMustBeBothPresentOrAbsent);
message = new IndirectSignedResponse(protocol.Version, recipient.Location);
}
} else if (string.Equals(mode, protocol.Args.Mode.check_authentication)) {
message = new CheckAuthenticationRequest(protocol.Version, recipient.Location);
} else if (string.Equals(mode, protocol.Args.Mode.error)) {
message = new IndirectErrorResponse(protocol.Version, recipient.Location);
} else {
ErrorUtilities.ThrowProtocol(MessagingStrings.UnexpectedMessagePartValue, protocol.openid.mode, mode);
}
}
if (message != null) {
message.SetAsIncoming();
}
return message;
}
开发者ID:jcp-xx,项目名称:dotnetopenid,代码行数:67,代码来源:OpenIdMessageFactory.cs
示例15: MessageBase
/// <summary>
/// Initializes a new instance of the <see cref="MessageBase"/> class for direct requests or indirect messages.
/// </summary>
/// <param name="protectionRequired">The level of protection the message requires.</param>
/// <param name="transport">A value indicating whether this message requires a direct or indirect transport.</param>
/// <param name="recipient">The URI that a directed message will be delivered to.</param>
/// <param name="version">The OAuth version.</param>
protected MessageBase(MessageProtections protectionRequired, MessageTransport transport, MessageReceivingEndpoint recipient, Version version) {
Contract.Requires<ArgumentNullException>(recipient != null);
Contract.Requires<ArgumentNullException>(version != null);
this.protectionRequired = protectionRequired;
this.transport = transport;
this.recipient = recipient;
this.Version = version;
}
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:16,代码来源:MessageBase.cs
示例16: GetNewRequestMessage
public override IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary<string, string> fields) {
var message = base.GetNewRequestMessage(recipient, fields);
// inject our own type here to replace the standard one
if (message is UnauthorizedTokenRequest) {
message = new RequestScopedTokenMessage(recipient, message.Version);
}
return message;
}
开发者ID:balamanikantak-sailfish,项目名称:DotNetOpenAuth.Samples,代码行数:10,代码来源:CustomOAuthTypeProvider.cs
示例17: OAuthManager
public OAuthManager(IHttpListenerManager listenerManager, DesktopConsumer consumer,
MessageReceivingEndpoint serviceEndPoint) {
this._listenerManager = listenerManager;
this._consumer = consumer;
this._serviceEndPoint = serviceEndPoint;
// Trying to fix https://github.com/flickr-downloadr/flickr-downloadr-gtk/issues/15
// From the comment in this SO answer:
// http://stackoverflow.com/questions/1186682/expectation-failed-when-trying-to-update-twitter-status/2025073#2025073
ServicePointManager.FindServicePoint(this._serviceEndPoint.Location).Expect100Continue = false;
}
开发者ID:qinhongwei,项目名称:flickr-downloadr-gtk,代码行数:10,代码来源:OAuthManager.cs
示例18: HttpsSignatureGeneration
public void HttpsSignatureGeneration() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint, Protocol.Default.Version);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
Assert.IsNotNull(target.ProcessOutgoingMessage(message));
Assert.AreEqual("PLAINTEXT", message.SignatureMethod);
Assert.AreEqual("cs&ts", message.Signature);
}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:11,代码来源:PlaintextSigningBindingElementTest.cs
示例19: HttpsSignatureVerification
public void HttpsSignatureVerification() {
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
ITamperProtectionChannelBindingElement target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint, Protocol.Default.Version);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
message.SignatureMethod = "PLAINTEXT";
message.Signature = "cs&ts";
Assert.IsNotNull(target.ProcessIncomingMessage(message));
}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:11,代码来源:PlaintextSigningBindingElementTest.cs
示例20: HttpsSignatureVerificationNotApplicable
public void HttpsSignatureVerificationNotApplicable() {
SigningBindingElementBase target = new PlaintextSigningBindingElement();
target.Channel = new TestChannel();
MessageReceivingEndpoint endpoint = new MessageReceivingEndpoint("https://localtest", HttpDeliveryMethods.GetRequest);
ITamperResistantOAuthMessage message = new UnauthorizedTokenRequest(endpoint, Protocol.Default.Version);
message.ConsumerSecret = "cs";
message.TokenSecret = "ts";
message.SignatureMethod = "ANOTHERALGORITHM";
message.Signature = "somethingelse";
Assert.AreEqual(MessageProtections.None, target.ProcessIncomingMessage(message), "PLAINTEXT binding element should opt-out where it doesn't understand.");
}
开发者ID:437072341,项目名称:dotnetopenid,代码行数:11,代码来源:PlaintextSigningBindingElementTest.cs
注:本文中的DotNetOpenAuth.Messaging.MessageReceivingEndpoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论