123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- namespace eprosima {
- namespace fastrtps {
- namespace rtps {
- namespace security {
- class Logging;
- enum ValidationResult_t : uint32_t
- {
- VALIDATION_OK = 0,
- VALIDATION_FAILED,
- VALIDATION_PENDING_RETRY,
- VALIDATION_PENDING_HANDSHAKE_REQUEST,
- VALIDATION_PENDING_HANDSHAKE_MESSAGE,
- VALIDATION_OK_WITH_FINAL_MESSAGE
- };
- class Authentication;
- class AuthenticationListener
- {
- virtual bool on_revoke_identity(Authentication& plugin,
- const IdentityHandle& handle,
- SecurityException& exception) = 0;
- };
- class Authentication
- {
- public:
- virtual ~Authentication() = default;
-
- virtual ValidationResult_t validate_local_identity(IdentityHandle** local_identity_handle,
- GUID_t& adjusted_participant_key,
- const uint32_t domain_id,
- const RTPSParticipantAttributes& participant_attr,
- const GUID_t& candidate_participant_key,
- SecurityException& exception) = 0;
-
- virtual ValidationResult_t validate_remote_identity(IdentityHandle** remote_identity_handle,
- const IdentityHandle& local_identity_handle,
- const IdentityToken& remote_identity_token,
- const GUID_t& remote_participant_key,
- SecurityException& exception) = 0;
-
- virtual ValidationResult_t begin_handshake_request(HandshakeHandle** handshake_handle,
- HandshakeMessageToken** handshake_message,
- const IdentityHandle& initiator_identity_handle,
- IdentityHandle& replier_identity_handle,
- const CDRMessage_t& cdr_participant_data,
- SecurityException& exception) = 0;
-
- virtual ValidationResult_t begin_handshake_reply(
- HandshakeHandle** handshake_handle,
- HandshakeMessageToken** handshake_message_out,
- HandshakeMessageToken&& handshake_message_in,
- IdentityHandle& initiator_identity_handle,
- const IdentityHandle& replier_identity_handle,
- const CDRMessage_t& cdr_participant_data,
- SecurityException& exception) = 0;
-
- virtual ValidationResult_t process_handshake(
- HandshakeMessageToken** handshake_message_out,
- HandshakeMessageToken&& handshake_message_in,
- HandshakeHandle& handshake_handle,
- SecurityException& exception) = 0;
-
- virtual SharedSecretHandle* get_shared_secret(
- const HandshakeHandle& handshake_handle,
- SecurityException& exception) = 0;
-
- virtual bool set_listener(AuthenticationListener* listener,
- SecurityException& exception) = 0;
- virtual bool get_identity_token(IdentityToken** identity_token,
- const IdentityHandle& handle,
- SecurityException& exception) = 0;
-
- virtual bool return_identity_token(IdentityToken* token,
- SecurityException& exception) = 0;
-
- virtual bool return_handshake_handle(HandshakeHandle* handshake_handle,
- SecurityException& exception) = 0;
-
- virtual bool return_identity_handle(IdentityHandle* identity_handle,
- SecurityException& exception) = 0;
-
- virtual bool return_sharedsecret_handle(SharedSecretHandle* sharedsecret_handle,
- SecurityException& exception) = 0;
- virtual bool set_permissions_credential_and_token(IdentityHandle& identity_handle,
- PermissionsCredentialToken& permissions_credential_token,
- SecurityException& ex) = 0;
- virtual bool get_authenticated_peer_credential_token(PermissionsCredentialToken **token,
- const IdentityHandle& identity_handle, SecurityException& exception) = 0;
- virtual bool return_authenticated_peer_credential_token(PermissionsCredentialToken* token,
- SecurityException& ex) = 0;
- bool set_logger(Logging* logger,
- SecurityException& )
- {
- logger_ = logger;
- return true;
- }
- protected:
- const Logging* get_logger() const
- {
- return logger_;
- }
- private:
- Logging* logger_ = nullptr;
- };
- }
- }
- }
- }
|