.. _program_listing_file__tmp_ws_src_fastrtps_include_fastdds_rtps_security_authentication_Authentication.h: Program Listing for File Authentication.h ========================================= |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/fastrtps/include/fastdds/rtps/security/authentication/Authentication.h``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef _FASTDDS_RTPS_SECURITY_AUTHENTICATION_AUTHENTICATION_H_ #define _FASTDDS_RTPS_SECURITY_AUTHENTICATION_AUTHENTICATION_H_ #include #include #include #include #include #include #include #include #include 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 std::shared_ptr get_shared_secret( const HandshakeHandle& handshake_handle, SecurityException& exception) const = 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 IdentityHandle* get_identity_handle( SecurityException& exception) = 0; virtual bool return_identity_handle( IdentityHandle* identity_handle, SecurityException& exception) = 0; virtual bool return_sharedsecret_handle( std::shared_ptr& sharedsecret_handle, SecurityException& exception) const = 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; virtual bool check_guid_comes_from( IdentityHandle* identity_handle, const GUID_t& adjusted, const GUID_t& original) { static_cast(identity_handle); return adjusted == original; } bool set_logger( Logging* logger, SecurityException& /*exception*/) { logger_ = logger; return true; } protected: const Logging* get_logger() const { return logger_; } private: Logging* logger_ = nullptr; }; } //namespace security } //namespace rtps } //namespace fastrtps } //namespace eprosima #endif // _FASTDDS_RTPS_SECURITY_AUTHENTICATION_AUTHENTICATION_H_