Beekeeper
view release on metacpan or search on metacpan
examples/chat/js/beekeeper.js view on Meta::CPAN
if (err) throw `Failed to subscribe to ${response_topic}: ${err}`;
}
);
},
accept_remote_calls: function(args) {
// This is included for reference, but please note that frontend clients
// should *not* be allowed to even connect to the backend broker, let alone
// consume from req/backend/*, as that would allow a malicious actor to
// disrupt services or steal other users credentials
if (!this.mqtt.connected) throw "Not connected to MQTT broker";
const subscr_id = this.subscr_seq++;
const on_receive = args.on_receive;
const This = this;
this.subscr_cb[subscr_id] = function(jsonrpc, packet_prop) {
// Incoming remote request
examples/websocket/js/beekeeper.js view on Meta::CPAN
if (err) throw `Failed to subscribe to ${response_topic}: ${err}`;
}
);
},
accept_remote_calls: function(args) {
// This is included for reference, but please note that frontend clients
// should *not* be allowed to even connect to the backend broker, let alone
// consume from req/backend/*, as that would allow a malicious actor to
// disrupt services or steal other users credentials
if (!this.mqtt.connected) throw "Not connected to MQTT broker";
const subscr_id = this.subscr_seq++;
const on_receive = args.on_receive;
const This = this;
this.subscr_cb[subscr_id] = function(jsonrpc, packet_prop) {
// Incoming remote request
lib/Beekeeper/Client.pm view on Meta::CPAN
my ($self, $data) = @_;
$self->{_CLIENT}->{auth_data} = $data;
}
sub __use_authorization_token {
my ($self, $token) = @_;
# Using a hashing function makes harder to access the wrong worker pool by mistake,
# but it is not an effective access restriction: anyone with access to the backend
# bus credentials can easily inspect and clone auth data tokens
my $salt = $self->{_CLIENT}->{auth_salt};
my $adata_ref = \$self->{_CLIENT}->{auth_data};
my $guard = Beekeeper::Client::Guard->new( $adata_ref );
$$adata_ref = md5_base64($token . $salt);
return $guard;
lib/Beekeeper/Worker.pm view on Meta::CPAN
}
return $self;
}
sub __init_auth_tokens {
my ($self) = @_;
# Using a hashing function makes harder to access the wrong worker pool by mistake,
# but it is not an effective access restriction: anyone with access to the backend
# bus credentials can easily inspect and clone auth data tokens
my $salt = $self->{_CLIENT}->{auth_salt};
$AUTH_TOKENS{'BKPR_SYSTEM'} = md5_base64('BKPR_SYSTEM'. $salt);
$AUTH_TOKENS{'BKPR_ADMIN'} = md5_base64('BKPR_ADMIN' . $salt);
$AUTH_TOKENS{'BKPR_ROUTER'} = md5_base64('BKPR_ROUTER'. $salt);
}
sub __has_authorization_token {
my ($self, $auth_level) = @_;
( run in 0.252 second using v1.01-cache-2.11-cpan-a5abf4f5562 )