(Migrated) aditional info about service execution

(This message has been automatically imported from the retired mailing list)

I want to share some experience with this list, that maybe help someone.
In Zato services there are a number of resources that you could use to
develop the service itself but still there are a few unknown ways to known
info about the service execution like the user, channel, that is being used
during the execution of the service.
the questions are:
1- How to know who is the user that is executing the service?
2- How to know who is the channel that is using the execution of the
service?

to answer this questions this are example ways:
1- To determine who is the user that is executing the service:

example for soap:

path_info = self.wsgi_environ.get(‘PATH_INFO’, False)
soap_action = self.wsgi_environ.get(‘HTTP_SOAPACTION’, False)
sec_info = self.worker_store.security.url_sec.getall(path_info)
for info in soap_channel_info:
if soap_action in info:
user_info = info[soap_action]

you could now access to data of the authenticated user that is running

the service if the used channel of the service execution require
authentication

like:

user_info.sec_def.name
user_info.sec_def.password
user_info.sec_def.sec_type

if user_info.sec_def.sec_type == ‘tech_acc’

user_info.sec_def.salt

if user_info.sec_def.sec_type == ‘basic_auth’

user_info.sec_def.username
user_info.sec_def.realm

if user_info.sec_def.sec_type == ‘wss’

user_info.sec_def.username
user_info.sec_def.password_type
user_info.sec_def.reject_empty_nonce_creat
user_info.sec_def.reject_stale_tokens
user_info.sec_def.reject_expiry_limit
user_info.sec_def.nonce_freshness_time

2- To determine what is the channel that is used in the execution of the
service

example for soap:

path_info = self.wsgi_environ.get(‘PATH_INFO’, False)
soap_action = self.wsgi_environ.get(‘HTTP_SOAPACTION’, False)
soap_channel_info =
self.worker_store.request_dispatcher.soap_handler.http_soap.getall(path_info)
for info in soap_channel_info:
if soap_action in info:
channel_info = info[soap_action]

you could now access to data of the channel used in the service execution

like:

channel_info.impl_name
channel_info.name
channel_info.soap_version
channel_info.is_internal
channel_info.is_active
channel_info.data_format
channel_info.method
channel_info.connection
channel_info.service_name
channel_info.service_id
channel_info.url_path
channel_info.id
channel_info.transport

All of this is based on my work with http_soap services, there are similar
ways for the other channels.

Hope this helps someone, Only my two cents for zato list

Hi Dariusz
All of this sounds very useful and remove the need to manually find the
values using the same code that Zato internally use to store and retrieve
those values.
What would include this user-visible API?
Is there a plan for create roles for internally used resources like, kvdb,
outgoing connections,… or any other use that security roles may be used
here?

cheers

On Thu, Jan 9, 2014 at 9:48 AM, Dariusz Suchojad dsuch@zato.io wrote:

On 01/09/2014 03:30 AM, Axel Mendoza Pupo wrote:

[…]

1- How to know who is the user that is executing the service?
2- How to know who is the channel that is using the execution of the
service?

[…]

Hi Alex,

thanks for sharing it - seeing as you have been working closer to the
underlying data structures, I’m wondering what you think about the
changes I’ve been considering for some time.

  • In 1.2 self.channel should be aliased to self.channel_type
  • In 1.3 self.channel should become a structure with attributes:
  • The second one would be pointing to self.channel_type, or the other
    way around, so older code would work

  • The last one would be the same as user_info.sec_def in the code
    snippets you shared

  • The implementation would be similar to what you posted but I’m rather
    thinking of the user-visible API for now - do you think the one above
    would answer your needs and sound useful?

On 01/09/2014 03:30 AM, Axel Mendoza Pupo wrote:

[…]

1- How to know who is the user that is executing the service?
2- How to know who is the channel that is using the execution of the
service?

[…]

Hi Alex,

thanks for sharing it - seeing as you have been working closer to the
underlying data structures, I’m wondering what you think about the
changes I’ve been considering for some time.

  • In 1.2 self.channel should be aliased to self.channel_type
  • In 1.3 self.channel should become a structure with attributes:
  • The second one would be pointing to self.channel_type, or the other
    way around, so older code would work

  • The last one would be the same as user_info.sec_def in the code
    snippets you shared

  • The implementation would be similar to what you posted but I’m rather
    thinking of the user-visible API for now - do you think the one above
    would answer your needs and sound useful?

On 01/09/2014 03:30 AM, Axel Mendoza Pupo wrote:

[…]

1- How to know who is the user that is executing the service?
2- How to know who is the channel that is using the execution of the
service?

[…]

Hi Alex,

thanks for sharing it - seeing as you have been working closer to the
underlying data structures, I’m wondering what you think about the
changes I’ve been considering for some time.

  • In 1.2 self.channel should be aliased to self.channel_type
  • In 1.3 self.channel should become a structure with attributes:
  • The second one would be pointing to self.channel_type, or the other
    way around, so older code would work

  • The last one would be the same as user_info.sec_def in the code
    snippets you shared

  • The implementation would be similar to what you posted but I’m rather
    thinking of the user-visible API for now - do you think the one above
    would answer your needs and sound useful?