-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
232 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#### Port | ||
Aeron.NET has been ported against Java version: | ||
- Agrona: 0.9.18-13-g0378ffa | ||
- Aeron: 1.9.2-341-gf6b702d9c | ||
- Aeron: 1.10.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Driver source: | ||
http://repo1.maven.org/maven2/io/aeron/aeron-all/1.10.0/aeron-all-1.10.0.jar | ||
http://repo1.maven.org/maven2/io/aeron/aeron-all/1.10.1/aeron-all-1.10.1.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/Adaptive.Aeron/Security/DefaultAuthenticatorSupplier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
|
||
namespace Adaptive.Aeron.Security | ||
{ | ||
/// <summary> | ||
/// Default Authenticator that authenticates all connection requests immediately. | ||
/// </summary> | ||
public class DefaultAuthenticatorSupplier : IAuthenticatorSupplier | ||
{ | ||
public static readonly byte[] NULL_ENCODED_PRINCIPAL = new byte[0]; | ||
public static readonly IAuthenticator DEFAULT_AUTHENTICATOR = new DefaultAuthenticator(); | ||
|
||
public IAuthenticator Get() | ||
{ | ||
return DEFAULT_AUTHENTICATOR; | ||
} | ||
|
||
private class DefaultAuthenticator : IAuthenticator | ||
{ | ||
public void OnConnectRequest(long sessionId, byte[] encodedCredentials, long nowMs) | ||
{ | ||
} | ||
|
||
public void OnChallengeResponse(long sessionId, byte[] encodedCredentials, long nowMs) | ||
{ | ||
} | ||
|
||
public void OnConnectedSession(ISessionProxy sessionProxy, long nowMs) | ||
{ | ||
sessionProxy.Authenticate(NULL_ENCODED_PRINCIPAL); | ||
} | ||
|
||
public void OnChallengedSession(ISessionProxy sessionProxy, long nowMs) | ||
{ | ||
sessionProxy.Authenticate(NULL_ENCODED_PRINCIPAL); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
namespace Adaptive.Aeron.Security | ||
{ | ||
/// <summary> | ||
/// Interface for Authenticator to handle authentication of clients to a system. | ||
/// <para> | ||
/// The session-id refers to the authentication session and not the Aeron transport session assigned to a publication. | ||
/// </para> | ||
/// </summary> | ||
public interface IAuthenticator | ||
{ | ||
/// <summary> | ||
/// Called upon reception of a Connect Request. | ||
/// </summary> | ||
/// <param name="sessionId"> to identify the client session connecting. </param> | ||
/// <param name="encodedCredentials"> from the Connect Request. Will not be null, but may be 0 length. </param> | ||
/// <param name="nowMs"> current epoch time in milliseconds. </param> | ||
void OnConnectRequest(long sessionId, byte[] encodedCredentials, long nowMs); | ||
|
||
/// <summary> | ||
/// Called upon reception of a Challenge Response from an unauthenticated client. | ||
/// </summary> | ||
/// <param name="sessionId"> to identify the client session connecting. </param> | ||
/// <param name="encodedCredentials"> from the Challenge Response. Will not be null, but may be 0 length. </param> | ||
/// <param name="nowMs"> current epoch time in milliseconds. </param> | ||
void OnChallengeResponse(long sessionId, byte[] encodedCredentials, long nowMs); | ||
|
||
/// <summary> | ||
/// Called when a client's response channel has been connected. This method may be called multiple times until the | ||
/// session is timeouts, is challenged, authenticated, or rejected. | ||
/// </summary> | ||
/// <param name="sessionProxy"> to use to inform client of status. </param> | ||
/// <param name="nowMs"> current epoch time in milliseconds. </param> | ||
/// <seealso cref= SessionProxy </seealso> | ||
void OnConnectedSession(ISessionProxy sessionProxy, long nowMs); | ||
|
||
/// <summary> | ||
/// Called when a challenged client should be able to accept a response from the authenticator. | ||
/// <para> | ||
/// When this is called, there is no assumption that a Challenge Response has been received, plus this method | ||
/// may be called multiple times. | ||
/// </para> | ||
/// <para> | ||
/// It is up to the concrete class to provide any timeout management. | ||
/// | ||
/// </para> | ||
/// </summary> | ||
/// <param name="sessionProxy"> to use to inform client of status. </param> | ||
/// <param name="nowMs"> current epoch time in milliseconds. </param> | ||
/// <seealso cref= SessionProxy </seealso> | ||
void OnChallengedSession(ISessionProxy sessionProxy, long nowMs); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Adaptive.Aeron.Security | ||
{ | ||
/// <summary> | ||
/// Used to supply instances of <see cref="IAuthenticator"/> | ||
/// </summary> | ||
public interface IAuthenticatorSupplier | ||
{ | ||
IAuthenticator Get(); | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
...ve.Cluster/Client/ICredentialsSupplier.cs → ...ve.Aeron/Security/ICredentialsSupplier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
namespace Adaptive.Cluster.Client | ||
namespace Adaptive.Aeron.Security | ||
{ | ||
/// <summary> | ||
/// Supplier of credentials for authentication with a cluster leader. | ||
/// Supplier of credentials for authentication with a system. | ||
/// | ||
/// Implement this interface to supply credentials for clients. If no credentials are required then the | ||
/// <seealso cref="NullCredentialsSupplier"/> can be used. | ||
/// </summary> | ||
public interface ICredentialsSupplier | ||
{ | ||
/// <summary> | ||
/// Provide a credential to be included in Session Connect message to the cluster. | ||
/// Provide a credential to be included in Session Connect message to a system. | ||
/// </summary> | ||
/// <returns> a credential in binary form to be included in the Session Connect message to the cluster. </returns> | ||
/// <returns> a credential in binary form to be included in the Session Connect message to system. </returns> | ||
byte[] EncodedCredentials(); | ||
|
||
/// <summary> | ||
/// Given some encoded challenge data, provide the credentials to be included in a Challenge Response as part of | ||
/// authentication with a cluster. | ||
/// authentication with a system. | ||
/// </summary> | ||
/// <param name="endcodedChallenge"> from the cluster to use in providing a credential. </param> | ||
/// <returns> encoded credentials in binary form to be included in the Challenge Response to the cluster. </returns> | ||
/// <returns> encoded credentials in binary form to be included in the Challenge Response to the system. </returns> | ||
byte[] OnChallenge(byte[] endcodedChallenge); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
namespace Adaptive.Aeron.Security | ||
{ | ||
/// <summary> | ||
/// Representation for a session which is going through the authentication process. | ||
/// </summary> | ||
public interface ISessionProxy | ||
{ | ||
/// <summary> | ||
/// The session Id of the potential session assigned by the system. | ||
/// </summary> | ||
/// <returns> session id for the potential session </returns> | ||
long SessionId(); | ||
|
||
/// <summary> | ||
/// Inform the system that the session requires a challenge and to send the provided encoded challenge. | ||
/// </summary> | ||
/// <param name="encodedChallenge"> to send to the client. </param> | ||
/// <returns> true if challenge was sent or false if challenge could not be sent. </returns> | ||
bool Challenge(byte[] encodedChallenge); | ||
|
||
/// <summary> | ||
/// Inform the system that the session has met authentication requirements. | ||
/// </summary> | ||
/// <param name="encodedPrincipal"> that has passed authentication. </param> | ||
/// <returns> true if success event was sent or false if success event could not be sent. </returns> | ||
bool Authenticate(byte[] encodedPrincipal); | ||
|
||
/// <summary> | ||
/// Inform the system that the session has NOT met authentication requirements and should be rejected. | ||
/// </summary> | ||
void Reject(); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...Cluster/Client/NullCredentialsSupplier.cs → ...Aeron/Security/NullCredentialsSupplier.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Collections.Generic; | ||
|
||
namespace Adaptive.Agrona.Collections | ||
{ | ||
public static class DictionaryExtensions | ||
{ | ||
public static TValue GetOrDefault<TKey, TValue>( | ||
this IDictionary<TKey, TValue> dictionary, | ||
TKey key, | ||
TValue @default = default(TValue)) | ||
{ | ||
return dictionary.TryGetValue(key, out var value) ? value : @default; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.