当前位置: 首页>>代码示例>>Python>>正文


Python kerberos.KrbError方法代码示例

本文整理汇总了Python中kerberos.KrbError方法的典型用法代码示例。如果您正苦于以下问题:Python kerberos.KrbError方法的具体用法?Python kerberos.KrbError怎么用?Python kerberos.KrbError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在kerberos的用法示例。


在下文中一共展示了kerberos.KrbError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: init_app

# 需要导入模块: import kerberos [as 别名]
# 或者: from kerberos import KrbError [as 别名]
def init_app(app):
    """Initializes application with kerberos"""

    hostname = app.config.get('SERVER_NAME')
    if not hostname:
        hostname = getfqdn()
    log.info("Kerberos: hostname %s", hostname)

    service = 'airflow'

    _KERBEROS_SERVICE.service_name = "{}@{}".format(service, hostname)

    if 'KRB5_KTNAME' not in os.environ:
        os.environ['KRB5_KTNAME'] = conf.get('kerberos', 'keytab')

    try:
        log.info("Kerberos init: %s %s", service, hostname)
        principal = kerberos.getServerPrincipalDetails(service, hostname)
    except kerberos.KrbError as err:
        log.warning("Kerberos: %s", err)
    else:
        log.info("Kerberos API: server is %s", principal) 
开发者ID:apache,项目名称:airflow,代码行数:24,代码来源:kerberos_auth.py

示例2: __init__

# 需要导入模块: import kerberos [as 别名]
# 或者: from kerberos import KrbError [as 别名]
def __init__(self, principal=None, serviceType=None, hostname=None):
        """

        @param principal:  full Kerberos principal (e.g., 'HTTP/server.example.com@EXAMPLE.COM'). If C{None}
            then the type and hostname arguments are used instead.
        @type principal:     str
        @param serviceType:       service type for Kerberos (e.g., 'HTTP'). Must be C{None} if principal used.
        @type serviceType:        str
        @param hostname:   hostname for this server. Must be C{None} if principal used.
        @type hostname:    str
        """

        # Only certain combinations of arguments allowed
        assert (principal and not serviceType and not hostname) or (not principal and serviceType and hostname)

        if not principal:
            # Look up the Kerberos principal given the service type and hostname, and extract
            # the realm and a service principal value for later use.
            try:
                principal = kerberos.getServerPrincipalDetails(serviceType, hostname)
            except kerberos.KrbError, ex:
                self.log.error("getServerPrincipalDetails: {ex}", ex=ex[0])
                raise ValueError('Authentication System Failure: %s' % (ex[0],)) 
开发者ID:apple,项目名称:ccs-calendarserver,代码行数:25,代码来源:authkerb.py


注:本文中的kerberos.KrbError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。