2013-07-17 14 views
5

के लिए एएसपी.NET होस्ट किए गए आईसीएस iCalendar को प्रमाणीकरण कैसे जोड़ें मेरे पास एक एएसपी.NET एप्लिकेशन है जो गतिशील रूप से एक आईसीएस कैलेंडर (using the DDay.iCal library) बनाता है जिसे मैं दृष्टिकोण के भीतर से सब्सक्राइब कर सकता हूं। सब ठीक काम कर रहे हैं, लेकिन मुझे कैलेंडर सुरक्षित करने में सक्षम होना चाहिए ताकि केवल प्रमाणीकृत उपयोगकर्ता इसे एक्सेस कर सकें। यानी जब आप Outlook में Outlook में URL जोड़ते हैं, तो उसे उपयोगकर्ता नाम और पासवर्ड मांगना होगा।आउटलुक

Remember The Milk seem to have implemented what I need, लेकिन मुझे यह हासिल करने के तरीके पर कोई जानकारी नहीं मिल रही है?

+1

शायद इस http://msdn.microsoft.com/en-us/library/aa479391.aspx –

+0

धन्यवाद @ChrisMoutray में देखें। मैंने लेख का वर्णन करने के आधार पर एक उत्तर लिखा है। –

उत्तर

7

The article Chris provided as a comment समाधान था।

कुछ अनुरोधों के लिए फॉर्म प्रमाणीकरण पास-पास करना आवश्यक है और इसके बजाय मूल HTTP प्रमाणीकरण का उपयोग करना आवश्यक है। इसके बाद इसे Outlook (और संभावित रूप से अन्य एजेंटों, जैसे वेब ब्राउज़र) द्वारा समर्थित किया जाता है।

यह MADAM Http Module का उपयोग कर हासिल किया जाता है।

कदम:

1> एक बुनियादी समझ हासिल करने के लेख पढ़ें।

2> मैडम NuGet पैकेज स्थापित करें: PM> इंस्टॉल करें-पैकेज महोदया

3> लागू अपनी खुद की IUserSecurityAuthority:

जैसे

public class MadamUserSecurityAuthority : IUserSecurityAuthority 
{ 
    public MadamUserSecurityAuthority() 
    { 

    } 

    //This constructor is required 
    public MadamUserSecurityAuthority(IDictionary options) 
    { 

    } 

    public object Authenticate(string userName, object password, PasswordFormat format, IDictionary options, string authenticationType) 
    { 
     if (_yourAuthenticationService.isValid(userName, password.ToString())) 
      return true; 

     //Returning null means the authentication failed 
     return null; 
    } 

    public string RealmName 
    { 
     get { return "MADAM"; } 
    } 
} 

4> जोड़ें निम्नलिखित आपकी वेब कॉन्फ़िगरेशन में:

उदाहरण:

<sectionGroup name="madam"> 
    <section name="userSecurityAuthority" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
    <section name="formsAuthenticationDisposition" type="Madam.FormsAuthenticationDispositionSectionHandler, Madam"/> 
</sectionGroup> 

<madam> 
    <formsAuthenticationDisposition> 
     <discriminators all="true"> 
      <discriminator inputExpression="Request.Url" pattern="Calendar\.aspx" type="Madam.RegexDiscriminator"/> 
     </discriminators> 
    </formsAuthenticationDisposition> 
    <userSecurityAuthority realm="MADAM" provider="YourAppAssembly.MadamUserSecurityAuthority, YourAppAssembly"/> 
</madam> 

<httpModules> 
    <add name="FormsAuthenticationDisposition" type="Madam.FormsAuthenticationDispositionModule, Madam"/> 
    <add name="AuthenticationModule" type="Madam.BasicAuthenticationModule, Madam"/>  
</httpModules> 

नोट 1:

<discriminator inputExpression="Request.Url" pattern="Calendar\.aspx" type="Madam.RegexDiscriminator"/> 

... जो अनुरोध करता बाई-पास रूपों प्रमाणीकरण और बुनियादी HTTP प्रमाणीकरण का उपयोग करें, इस Regex साथ किया जाता है चाहिए की पहचान के लिए प्रयोग किया जाता है, और आप जोड़ सकते हैं एकाधिक भेदभाव करने वाले।

नोट 2:

<userSecurityAuthority realm="MADAM" provider="YourAppAssembly.MadamUserSecurityAuthority, YourAppAssembly"/> 

.... जहां आप अपने कस्टम प्रमाणीकरण प्रदाता कॉन्फ़िगर नहीं है (यानी जहाँ आप अपने DB के खिलाफ साख की जाँच करें)।

संबंधित मुद्दे