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
评论列表
文章目录