steam.py 文件源码

python
阅读 48 收藏 0 点赞 0 评论 0

项目:drift 作者: dgnorth 项目源码 文件源码
def validate_steam_ticket():
    """Validate steam ticket from /auth call."""

    ob = request.get_json()    
    check_schema(ob, steam_provider_schema, "Error in request body.")
    provider_details = ob['provider_details']
    auth_config = current_app.config.get('authentication')

    # Get Steam authentication config
    steam_config = auth_config.get('steam')
    if not steam_config:
        abort(httplib.SERVICE_UNAVAILABLE, description="Steam authentication not configured for current tenant")

    # Find configuration for the requested Steam app id.
    appid = provider_details.get('appid')
    for steam_app in steam_config:
        if steam_app['appid'] == int(provider_details.get('appid')):  # Cast to int is temporary hack
            break
    else:
        abort(httplib.SERVICE_UNAVAILABLE, description="Steam authentication not configured for app %s." % appid)

    # Look up our secret key or key url
    key_url = steam_app.get('key_url')
    key = steam_app.get('key')
    if not key_url and not key:
        log.error("Steam tickets cannot be validated. AUTH_STEAM_KEY_URL or AUTH_STEAM_KEY missing from config.")
        abort(httplib.SERVICE_UNAVAILABLE, description="Steam tickets cannot be validated at the moment.")

    # Call validation and authenticate if ticket is good
    identity_id = run_ticket_validation(provider_details, key_url=key_url, key=key, appid=appid)
    return identity_id
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号