| 53 | proton::listener listener; |
| 54 | |
| 55 | void on_connection_open(proton::connection &c) override { |
| 56 | std::cout << "Inbound server connection connected via SSL. Protocol: " << |
| 57 | c.transport().ssl().protocol() << std::endl; |
| 58 | if (c.transport().sasl().outcome() == sasl::OK) { |
| 59 | std::string subject = c.transport().ssl().remote_subject(); |
| 60 | std::cout << "Inbound client certificate identity " << find_CN(subject) << std::endl; |
| 61 | } |
| 62 | else { |
| 63 | std::cout << "Inbound client authentication failed" <<std::endl; |
| 64 | c.close(); |
| 65 | } |
| 66 | listener.stop(); |
| 67 | |
| 68 | // Go and do default inbound open stuff too |
| 69 | messaging_handler::on_connection_open(c); |
| 70 | } |
| 71 | |
| 72 | void on_message(proton::delivery &, proton::message &m) override { |
| 73 | std::cout << m.body() << std::endl; |