• 大小: 7.02MB
    文件类型: .7z
    金币: 1
    下载: 0 次
    发布日期: 2023-10-03
  • 语言: 其他
  • 标签: 单点登陆  

资源简介

用于单点登陆DotNetOpenAuth

资源截图

代码片段和文件信息

//-----------------------------------------------------------------------
// 
//     Copyright (c) Andrew Arnott. All rights reserved.
// 
//-----------------------------------------------------------------------

namespace DotNetOpenAuth.ApplicationBlock {
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.Regularexpressions;
using System.xml;
using System.xml.Linq;
using DotNetOpenAuth.Messaging;
using DotNetOpenAuth.OAuth;
using DotNetOpenAuth.OAuth.ChannelElements;

/// 
/// A consumer capable of communicating with Google Data APIs.
/// 

public static class GoogleConsumer {
/// 
/// The Consumer to use for accessing Google data APIs.
/// 

public static readonly ServiceProviderDescription ServiceDescription = new ServiceProviderDescription {
RequestTokenEndpoint = new MessageReceivingEndpoint(“https://www.google.com/accounts/OAuthGetRequestToken“ HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest)
UserAuthorizationEndpoint = new MessageReceivingEndpoint(“https://www.google.com/accounts/OAuthAuthorizeToken“ HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest)
AccessTokenEndpoint = new MessageReceivingEndpoint(“https://www.google.com/accounts/OAuthGetAccessToken“ HttpDeliveryMethods.AuthorizationHeaderRequest | HttpDeliveryMethods.GetRequest)
TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() }
};

/// 
/// A mapping between Google‘s applications and their URI scope values.
/// 

private static readonly Dictionary DataScopeUris = new Dictionary {
{ Applications.Analytics “https://www.google.com/analytics/feeds/“ }
{ Applications.Googlebase “http://www.google.com/base/feeds/“ }
{ Applications.Blogger “http://www.blogger.com/feeds“ }
{ Applications.BookSearch “http://www.google.com/books/feeds/“ }
{ Applications.Calendar “http://www.google.com/calendar/feeds/“ }
{ Applications.Contacts “http://www.google.com/m8/feeds/“ }
{ Applications.DocumentsList “http://docs.google.com/feeds/“ }
{ Applications.Finance “http://finance.google.com/finance/feeds/“ }
{ Applications.Gmail “https://mail.google.com/mail/feed/atom“ }
{ Applications.Health “https://www.google.com/h9/feeds/“ }
{ Applications.Maps “http://maps.google.com/maps/feeds/“ }
{ Applications.OpenSocial “http://sandbox.gmodules.com/api/“ }
{ Applications.PicasaWeb “http://picasaweb.google.com/data/“ }
{ Applications.Spreadsheets “http://spreadsheet

评论

共有 条评论