2010-06-03 Jb Evain <jbevain@novell.com>
[mcs.git] / class / System.ServiceModel / System.ServiceModel.Security.Tokens / CommunicationSecurityTokenAuthenticator.cs
blob94cb1ec7e8090ffb1ca58384688d76e73d650100
1 //
2 // CommunicationSecurityTokenAuthenticator.cs
3 //
4 // Author:
5 // Atsushi Enomoto <atsushi@ximian.com>
6 //
7 // Copyright (C) 2007 Novell, Inc. http://www.novell.com
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using System.Collections.ObjectModel;
30 using System.IdentityModel.Policy;
31 using System.IdentityModel.Selectors;
32 using System.IdentityModel.Tokens;
34 namespace System.ServiceModel.Security.Tokens
36 abstract class CommunicationSecurityTokenAuthenticator
37 : SecurityTokenAuthenticator, ICommunicationObject,
38 IIssuanceSecurityTokenAuthenticator
40 protected CommunicationSecurityTokenAuthenticator ()
44 IssuedSecurityTokenHandler issuance_handler;
45 RenewedSecurityTokenHandler renew_handler;
47 public IssuedSecurityTokenHandler IssuedSecurityTokenHandler {
48 get { return issuance_handler; }
49 set { issuance_handler = value; }
52 public RenewedSecurityTokenHandler RenewedSecurityTokenHandler {
53 get { return renew_handler; }
54 set { renew_handler = value; }
57 public abstract AuthenticatorCommunicationObject Communication { get; }
59 [MonoTODO]
60 protected override bool CanValidateTokenCore (SecurityToken token)
62 throw new NotImplementedException ();
65 [MonoTODO]
66 protected override ReadOnlyCollection<IAuthorizationPolicy> ValidateTokenCore (SecurityToken token)
68 throw new NotImplementedException ();
71 public CommunicationState State {
72 get { return Communication.State; }
75 public void Abort ()
77 Communication.Abort ();
80 public void Open ()
82 Communication.Open ();
85 public void Open (TimeSpan timeout)
87 Communication.Open (timeout);
90 public IAsyncResult BeginOpen (AsyncCallback callback, object state)
92 return Communication.BeginOpen (callback, state);
95 public IAsyncResult BeginOpen (TimeSpan timeout, AsyncCallback callback, object state)
97 return Communication.BeginOpen (timeout, callback, state);
100 public void EndOpen (IAsyncResult result)
102 Communication.EndOpen (result);
105 public void Close ()
107 Communication.Close ();
110 public void Close (TimeSpan timeout)
112 Communication.Close (timeout);
115 public IAsyncResult BeginClose (AsyncCallback callback, object state)
117 return Communication.BeginClose (callback, state);
120 public IAsyncResult BeginClose (TimeSpan timeout, AsyncCallback callback, object state)
122 return Communication.BeginClose (timeout, callback, state);
125 public void EndClose (IAsyncResult result)
127 Communication.EndClose (result);
130 public event EventHandler Opening {
131 add { Communication.Opening += value; }
132 remove { Communication.Opening -= value; }
135 public event EventHandler Opened {
136 add { Communication.Opened += value; }
137 remove { Communication.Opened -= value; }
140 public event EventHandler Closing {
141 add { Communication.Closing += value; }
142 remove { Communication.Closing -= value; }
145 public event EventHandler Closed {
146 add { Communication.Closed += value; }
147 remove { Communication.Closed -= value; }
150 public event EventHandler Faulted {
151 add { Communication.Faulted += value; }
152 remove { Communication.Faulted -= value; }