-
Notifications
You must be signed in to change notification settings - Fork 135
Security
Keith Sterling edited this page Jul 31, 2017
·
12 revisions
Program-Y provides 2 key elements of security
def ask_question(self, bot, clientid, sentence) -> str:
if self.authentication is not None:
if self.authentication.authenticate(clientid) is False:
logging.error("[%s] failed authentication!")
return self.authentication.configuration.denied_srai
The base class is defined as
class Authenticator(object):
def __init__(self, configuration: BrainSecurityConfiguration):
self._configuration = configuration
@property
def configuration(self):
return self._configuration
def get_default_denied_srai(self):
return self.configuration.denied_srai
def authenticate(self, clientid: str):
return False
Configuration is defined as
security:
authentication:
classname: programy.utils.security.authenticate.passthrough.BasicPassThroughAuthenticationService
denied_srai: AUTHENTICATION_FAILED
<category>
<pattern>ALLOW ACCESS</pattern>
<template>
<authorise role="root">
Access Allowed
</authorise>
</template>
</category>
The base class for all authorisation is defined as
class Authoriser(object):
def __init__(self, configuration: BrainSecurityConfiguration):
self._configuration = configuration
@property
def configuration(self):
return self._configuration
def get_default_denied_srai(self):
return self.configuration.denied_srai
def authorise(self, userid, role):
return False
Configuration is defined as
security:
authorisation:
classname: programy.utils.security.authorise.usergroupsauthorisor.BasicUserGroupAuthorisationService
denied_srai: AUTHORISATION_FAILED
usergroups: $BOT_ROOT/config/roles.yaml
Email: [email protected] | Twitter: @keiffster | Facebook: keith.sterling | LinkedIn: keithsterling | My Blog
- Home
- Background
- Guiding Principles
- Reporting an Issue
- Installation
- You And Your Bot
- Bots
- Clients
- Configuration
- AIML
- Sentence Splitting
- Natural Langauge Processing
- Normalization
- Spelling
- Sentiment Analysis
- Translation
- Security
- Hot Reload
- Logging
- Out of Band
- Multi Language
- RDF Support
- Rich Media
- Asynchronous Events
- Triggers
- External Services
- Dynamic Sets, Maps & Vars
- Extensions
- Pre & Post Processors
- Custom Nodes
- The Brain Tree
- Utilities
- Building It Yourself
- Creating Your Own Bot
- Contributing
- Performance Testing
- FAQ
- History
- Website