arcrest.security package

Submodules

arcrest.security.security module

Handles all the security operations for the product logins.

class arcrest.security.security.AGOLTokenSecurityHandler(username, password, org_url='https://www.arcgis.com', token_url=None, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

handles ArcGIS Online Token Base Security username - required - username to access AGOL services password - required - password for username above org_url - The url of that ArcGIS Organization. This url is

composed on the machine name and the instance name of the portal. For example: http://myportal.mycompany.com/portal for a Portal for ArcGIS Server instance.

token_url - optional - if URL is different than default AGOL token
url, then enter it here for AGOL token service.
proxy_url - optional - if proxy is required to access internet, the
IP goes here.
proxy_post - optional - if proxy is used and it’s not port 90 enter
it here.
check_portal()[source]
is_portal
method

returns the handler method

org_url

gets/sets the organization URL

password

returns **** for the password

proxy_port

gets the proxy port

proxy_url

gets the proxy url

referer_url

returns when the token was generated

resetTokenURLToDefault()[source]

resets the token url to the default url

token

returns the token for the site

tokenExperationDate

returns when the token is not valid

tokenObtainedDate

returns when the token was generated

token_url

returns the token url

username

returns the username

class arcrest.security.security.AGSTokenSecurityHandler(username, password, org_url=None, token_url=None, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

handles ArcGIS Server Security username - required - person accessing server password - required - login credential token_url - required - URL to generate a token on server proxy_url - optional - IP of proxy proxy_port - optional - port of the proxy server

method

returns the handler method

password

returns **** for the password

proxy_port

gets the proxy port

proxy_url

gets the proxy url

referer_url

returns when the token was generated

token

returns the token for the site

tokenExperationDate

returns when the token is not valid

tokenObtainedDate

returns when the token was generated

token_url

returns the token url

username

returns the username

class arcrest.security.security.ArcGISTokenSecurityHandler(proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

handles ArcGIS Maps Token Base Security

check_portal()[source]
is_portal
method

returns the handler method

org_url

gets/sets the organization URL

proxy_port

gets the proxy port

proxy_url

gets the proxy url

referer_url

returns when the token was generated

servertoken(serverURL, referer)[source]

returns the server token for the server

token

returns the token for the site

tokenExperationDate

returns when the token is not valid

username

returns the username

class arcrest.security.security.CommunityMapsSecurityHandler(url, username, password, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

Handler that allows access to the community maps program

securityhandler

ges/set the AGOLTokenSecurityHandler

token

generates a token

class arcrest.security.security.LDAPSecurityHandler(org_url, username, password, proxy_url=None, proxy_port=None, referer_url=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

This Security Handler handles LDAP based security.

check_portal()[source]
cookiejar

gets the cookiejar

handler

returns the handler

is_portal
loadusername()[source]
method

get the security handler type

org_url

gets the org_url

password

gets/sets the current password

portalServerHandler(serverUrl, username=None)[source]

returns a handler to access a federated server

serverUrl - url to the server. Example:
https://server.site.com/arcgis
username - the portal site username. if None is passed, it obtains
it from the portal properties
Outout:
returns a PortalServerSecurityHandler object

Usage: >>> # access the administration site >>> serverUrl=”https://mysite.site.com/arcgis” >>> newSH = sh.portalServerHandler(serverUrl=serverUrl,

username=None)
>>> agsAdmin = AGSAdministration(url=serverUrl, securityHandler=newSH)
>>> print agsAdmin.info
>>> # access a secure service from portal handler
>>> msUrl = "https://mysite.site.com:6443/arcgis/rest/services/SampleWorldCities/MapServer"
>>> ms = arcrest.ags.MapService(url=msUrl, securityHandler=newSH)
>>> print ms.mapName
proxy_port

gets the proxy port

proxy_url

gets the proxy url

referer_url

gets the referer url

token

gets the token

username

gets/sets the username

class arcrest.security.security.NTLMSecurityHandler(org_url, username, password, proxy_url=None, proxy_port=None, referer_url=None)[source]

Bases: arcrest.security.security.LDAPSecurityHandler

performs NTLM/Kerberos security handling

cookiejar

gets the cookiejar

handler

gets the security handler for the class

class arcrest.security.security.OAuthSecurityHandler(client_id, secret_id, org_url, token_url=None, proxy_url=None, proxy_port=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

Handles AGOL OAuth Security Inputs:

client_id - OAuth client key secret_id - OAuth secret key org_url - The url of that ArcGIS Organization. This url is

composed on the machine name and the instance name of the portal. For example: http://myportal.mycompany.com/portal for a Portal

for ArcGIS Server instance.

token_url - optional - url to where the token is obtained proxy_url - optional - proxy url as a string proxy_port - optional - proxy port as integer

Output:
OAuthSecurityHandler Class Object
check_portal()[source]
client_id

returns the client id

is_portal
method

returns the handler method

org_url

gets/sets the organization URL

proxy_port

gets the proxy port

proxy_url

gets the proxy url

referer_url

returns when the token was generated

resetTokenURLToDefault()[source]

resets the token url to the default url

secret_id

returns * for secret id

token

obtains a token from the site

tokenExperationDate

returns when the token is not valid

tokenObtainedDate

returns when the token was generated

token_url

returns the token url

class arcrest.security.security.PKISecurityHandler(org_url, keyfile, certificatefile, proxy_url=None, proxy_port=None, referer_url=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

This Security Handler handles PKI based security

class HTTPSClientAuthHandler(key, cert)[source]

Bases: urllib2.HTTPSHandler

getConnection(host, timeout=300)[source]
httplib = <module 'httplib' from 'C:\Python27\ArcGIS10.2\lib\httplib.pyc'>
https_open(req)[source]
PKISecurityHandler.certificate

gets/sets the certificate file

PKISecurityHandler.check_portal()[source]
PKISecurityHandler.cookiejar

gets the cookiejar

PKISecurityHandler.handler

returns the handler

PKISecurityHandler.is_portal
PKISecurityHandler.key_file

returns the key file

PKISecurityHandler.method

get the security handler type

PKISecurityHandler.org_url

gets the org_url

PKISecurityHandler.proxy_port

gets the proxy port

PKISecurityHandler.proxy_url

gets the proxy url

PKISecurityHandler.referer_url

gets the referer url

PKISecurityHandler.token

gets the token

PKISecurityHandler.username

returns the username

class arcrest.security.security.PortalServerSecurityHandler(tokenHandler, serverUrl, referer, handler=None, jar=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

This service is designed to allow users manage a server from a Portal site credentials. This means a user can get an ArcGIS Server Token from a Portal login to manage and use secure services. It is not designed for users to create this object through code, but rather it is generated by the system.

cookiejar

gets the cookiejar

handler

gets/sets a handler

is_portal
method

returns the handler method

referer

gets/sets the referer object

serverUrl

gets/sets the server url

token

gets the AGS server token

class arcrest.security.security.PortalTokenSecurityHandler(username, password, org_url, token_url=None, proxy_url=None, proxy_port=None, handler=None, jar=None)[source]

Bases: arcrest._abstract.abstract.BaseSecurityHandler

Handles connection to a Portal Site

Inputs:

username - name of the user password - password for user org_url - The url of that ArcGIS Organization. This url is

composed on the machine name and the instance name of the portal. For example: http://myportal.mycompany.com/portal for a Portal for ArcGIS Server instance.

proxy_url - URL of the proxy proxy_port - proxy port

check_portal()[source]
cookiejar

gets the cookiejar

handler

gets/sets a handler

is_portal
method

returns the handler method

org_url

gets/sets the organization URL

password

returns **** for the password

portalServerHandler(serverUrl, username=None)[source]

returns a handler to access a federated server

serverUrl - url to the server. Example:
https://server.site.com/arcgis
username - the portal site username. if None is passed, it obtains
it from the portal properties
Outout:
returns a PortalServerSecurityHandler object

Usage: >>> # access the administration site >>> serverUrl=”https://mysite.site.com/arcgis” >>> newSH = sh.portalServerHandler(serverUrl=serverUrl,

username=None)
>>> agsAdmin = AGSAdministration(url=serverUrl, securityHandler=newSH)
>>> print agsAdmin.info
>>> # access a secure service from portal handler
>>> msUrl = "https://mysite.site.com:6443/arcgis/rest/services/SampleWorldCities/MapServer"
>>> ms = arcrest.ags.MapService(url=msUrl, securityHandler=newSH)
>>> print ms.mapName
proxy_port

gets the proxy port

proxy_url

gets the proxy url

referer_url

returns when the token was generated

servertoken(serverURL, referer)[source]

returns the server token for the server

token

returns the token for the site

tokenExperationDate

returns when the token is not valid

tokenObtainedDate

returns when the token was generated

token_url

returns the token url

username

returns the username

Module contents