Skip to content

Commit 286d3b6

Browse files
author
Elad Zelingher
committed
Adding some xml summaries for WAMP-CRA
1 parent 986977d commit 286d3b6

File tree

8 files changed

+89
-2
lines changed

8 files changed

+89
-2
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,28 @@
11
namespace WampSharp.Core.Cra
22
{
3+
/// <summary>
4+
/// Represents details of a WAMP-CRA challenge.
5+
/// </summary>
36
public interface IWampCraChallenge
47
{
8+
/// <summary>
9+
/// Gets the salt to use in order to compute the signature, sent to the user that upon CHALLENGE
10+
/// message. (in challenge.extra)
11+
/// </summary>
512
string Salt { get; }
13+
14+
/// <summary>
15+
/// Gets the number of iterations to use in order to compute the signature,
16+
/// sent to the user that upon CHALLENGE
17+
/// message. (in challenge.extra)
18+
/// </summary>
619
int? Iterations { get; }
20+
21+
/// <summary>
22+
/// Gets the keylength to use in order to compute the signature,
23+
/// sent to the user that upon CHALLENGE
24+
/// message. (in challenge.extra)
25+
/// </summary>
726
int? KeyLength { get; }
827
}
928
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
namespace WampSharp.V2.Authentication
22
{
3+
/// <summary>
4+
/// Represents a database of WampCra users.
5+
/// </summary>
36
public interface IWampCraUserDb
47
{
8+
/// <summary>
9+
/// Gets the requetsed user's details given its authentication id.
10+
/// </summary>
11+
/// <param name="authenticationId">The requested user's authentication id.</param>
12+
/// <returns>The user's WAMP-CRA authentication details.</returns>
513
WampCraUser GetUserById(string authenticationId);
614
}
715
}

src/net45/WampSharp/WAMP2/V2/Authentication/WampCra/WampCraChallengeDetails.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44

55
namespace WampSharp.V2.Authentication
66
{
7+
/// <summary>
8+
/// An implementation of <see cref="ChallengeDetails"/> specific for WAMP-CRA authentication.
9+
/// </summary>
710
[DataContract]
811
public class WampCraChallengeDetails : ChallengeDetails, IWampCraChallenge
912
{
1013
private const int DefaultIterations = 1000;
1114
private const int DefaultKeyLength = 32;
1215

16+
/// <summary>
17+
/// Instantiates a new instance of <see cref="WampCraChallengeDetails"/>.
18+
/// </summary>
19+
/// <param name="salt">The salt to use, sent to the user upon CHALLENGE.extra.</param>
20+
/// <param name="iterations">The number of iterations to use, sent to the user upon CHALLENGE.extra.</param>
21+
/// <param name="keyLen">The key length to use, sent to the user upon CHALLENGE.extra.</param>
1322
public WampCraChallengeDetails(string salt,
1423
int? iterations = DefaultIterations,
1524
int? keyLen = DefaultKeyLength)
@@ -23,6 +32,10 @@ internal WampCraChallengeDetails()
2332
{
2433
}
2534

35+
/// <summary>
36+
/// Gets the authentication challenge - this is the challenge that will be sent upon CHALLENGE
37+
/// message. (in challenge.extra)
38+
/// </summary>
2639
[DataMember(Name = "challenge")]
2740
public string Challenge { get; internal set; }
2841

src/net45/WampSharp/WAMP2/V2/Authentication/WampCra/WampCraSessionAuthenticator.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace WampSharp.V2.Authentication
77
{
8+
/// <summary>
9+
/// An abstract class for an implementation of a WAMP-CRA <see cref="IWampSessionAuthenticator"/>.
10+
/// </summary>
811
public abstract class WampCraSessionAuthenticator : WampSessionAuthenticator
912
{
1013
private readonly string mAuthenticationId;

src/net45/WampSharp/WAMP2/V2/Authentication/WampCra/WampCraStaticUserDb.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,18 @@
22

33
namespace WampSharp.V2.Authentication
44
{
5+
/// <summary>
6+
/// Represents a static data based implementation of <see cref="IWampCraUserDb"/>.
7+
/// </summary>
58
public class WampCraStaticUserDb : IWampCraUserDb
69
{
710
private readonly IDictionary<string, WampCraUser> mUsers;
811

12+
/// <summary>
13+
/// Instantiates a new instance of <see cref="WampCraStaticUserDb"/> given
14+
/// a map of authentication id to WAMP-CRA user details.
15+
/// </summary>
16+
/// <param name="users">The given map of authentication id to WAMP-CRA user details.</param>
917
public WampCraStaticUserDb(IDictionary<string, WampCraUser> users)
1018
{
1119
mUsers = users;

src/net45/WampSharp/WAMP2/V2/Authentication/WampCra/WampCraUser.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@
22

33
namespace WampSharp.V2.Authentication
44
{
5+
/// <summary>
6+
/// Represents details of a WAMP-CRA user.
7+
/// </summary>
58
public class WampCraUser : IWampCraChallenge
69
{
10+
/// <summary>
11+
/// Gets the user's authentication id. If null, uses HELLO.details.authid.
12+
/// </summary>
713
public string AuthenticationId { get; set; }
814

15+
/// <summary>
16+
/// Gets the user's authentication role.
17+
/// </summary>
918
public string AuthenticationRole { get; set; }
1019

20+
/// <summary>
21+
/// Gets the user's secret. If salted, contains the derived key (and NOT the actual secret).
22+
/// </summary>
1123
public string Secret { get; set; }
1224

1325
public string Salt { get; set; }

src/net45/WampSharp/WAMP2/V2/Authentication/WampCra/WampCraUserDbAuthenticationFactory.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,23 @@
44

55
namespace WampSharp.V2.Authentication
66
{
7+
/// <summary>
8+
/// An implementation of <see cref="IWampSessionAuthenticatorFactory"/>
9+
/// which is based on <see cref="IWampCraUserDb"/> and <see cref="IWampAuthenticationProvider"/>.
10+
/// </summary>
711
public class WampCraUserDbAuthenticationFactory : IWampSessionAuthenticatorFactory
812
{
9-
private const string WAMP_CRA = WampAuthenticationMethods.WampCra;
13+
private const string WampCra = WampAuthenticationMethods.WampCra;
1014
private readonly IWampAuthenticationProvider mAuthenticationProvider;
1115
private readonly IWampCraUserDb mUserDb;
1216

17+
/// <summary>
18+
/// Instantiates a new instance of <see cref="WampCraUserDbAuthenticationFactory"/>
19+
/// given the <see cref="IWampAuthenticationProvider"/> and
20+
/// the <see cref="IWampCraUserDb"/> to use.
21+
/// </summary>
22+
/// <param name="authenticationProvider">The <see cref="IWampAuthenticationProvider"/> to get role permissions.</param>
23+
/// <param name="userDb">The <see cref="IWampCraUserDb"/> to use to get user WAMP-CRA details.</param>
1324
public WampCraUserDbAuthenticationFactory(IWampAuthenticationProvider authenticationProvider,
1425
IWampCraUserDb userDb)
1526
{
@@ -24,7 +35,7 @@ public IWampSessionAuthenticator GetSessionAuthenticator
2435
HelloDetails helloDetails = details.HelloDetails;
2536

2637
if ((helloDetails.AuthenticationMethods == null) ||
27-
!helloDetails.AuthenticationMethods.Contains(WAMP_CRA))
38+
!helloDetails.AuthenticationMethods.Contains(WampCra))
2839
{
2940
throw new WampAuthenticationException("supports only 'wampcra' authentication");
3041
}

src/net45/WampSharp/WAMP2/V2/Authentication/WampCra/WampCraUserDbSessionAuthenticator.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@
33

44
namespace WampSharp.V2.Authentication
55
{
6+
/// <summary>
7+
/// An implementation of <see cref="IWampSessionAuthenticator"/> which uses
8+
/// <see cref="WampCraUser"/> in order to compute WAMP-CRA key, and uses
9+
/// <see cref="WampAuthenticationRole"/> in order to check permissions.
10+
/// </summary>
611
public class WampCraUserDbSessionAuthenticator : WampCraSessionAuthenticator
712
{
813
private readonly WampCraUser mUser;
914
private readonly string mAuthenticationChallenge;
1015

16+
/// <summary>
17+
/// Instantiates a new instance of <see cref="WampCraUserDbSessionAuthenticator"/>
18+
/// given the WAMP-CRA user details, the <see cref="WampAuthenticationRole"/> and
19+
/// the user's session id.
20+
/// </summary>
21+
/// <param name="user">The given user's WAMP-CRA details, used for authentication.</param>
22+
/// <param name="role">The given user's role, used for authorization.</param>
23+
/// <param name="sessionId">The given user's session id.</param>
1124
public WampCraUserDbSessionAuthenticator(WampCraUser user, WampAuthenticationRole role, long sessionId) :
1225
base(user.AuthenticationId)
1326
{

0 commit comments

Comments
 (0)