def validate_psn_ticket(): """Validate PSN ticket from /auth call.""" ob = request.get_json() check_schema(ob, psn_provider_schema, "Error in request body.") provider_details = ob['provider_details'] # Get authentication config auth_config = current_app.config.get('authentication') # Get PSN authentication config psn_config = auth_config.get('psn') if not psn_config: abort( httplib.SERVICE_UNAVAILABLE, description="PSN authentication not configured for current tenant") # Call validation and authenticate if ticket is good identity_id = run_ticket_validation( user_id=provider_details['psn_id'], auth_code=provider_details['auth_code'], issuer=provider_details['issuer'], client_id=psn_config['client_id'], client_secret=psn_config['client_secret']) return identity_id
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
def validate_oculus_ticket(): """Validate Oculus ticket from /auth call.""" ob = request.get_json() check_schema(ob, oculus_provider_schema, "Error in request body.") provider_details = ob['provider_details'] auth_config = current_app.config.get('authentication') # Get Oculus authentication config oculus_config = auth_config.get('oculus') if not oculus_config: abort(httplib.SERVICE_UNAVAILABLE, description="Oculus authentication not configured for current tenant") # Call validation and authenticate if ticket is good identity_id = run_ticket_validation( user_id=provider_details['user_id'], access_token=oculus_config['access_token'], nonce=provider_details['nonce'] ) return identity_id
def validate_googleplay_token(): """Validate Google Play token from /auth call.""" ob = request.get_json() check_schema(ob, googleplay_provider_schema, "Error in request body.") provider_details = ob['provider_details'] # Get Google Play authentication config gp_config = get_provider_config('googleplay') if not gp_config: abort(httplib.SERVICE_UNAVAILABLE, description= "Google Play authentication not configured for current tenant") app_client_ids = gp_config.get("client_ids", None) # Call validation and authenticate if token is good identity_id = run_token_validation(user_id=provider_details['user_id'], id_token=provider_details['id_token'], app_client_ids=app_client_ids) return identity_id