'Generate a redirect to a Biostar site using external authentication to
pass Galaxy user information and optional information about a specific tool.'

@web.expose
def biostar_redirect(self, trans, payload=None, biostar_action=None):

    try:
        (url, payload) = biostar.get_biostar_url(trans.app, payload=payload, biostar_action=biostar_action)
    except Exception as e:
        return error(str(e))
    if trans.user:
        biostar.create_cookie(trans, trans.app.config.biostar_key_name, trans.app.config.biostar_key, trans.user.email)
    if payload:
        return trans.fill_template('biostar/post_redirect.mako', post_url=url, form_inputs=payload)
    return trans.response.send_redirect(url)
