简体   繁体   English

Nexus 3-使用经过身份验证的用户重定向到“创建存储库”页面

[英]Nexus 3 - Redirect to Create Repository page with authenticated user

I have a rails application which interacts with Nexus via API calls. 我有一个Rails应用程序,可通过API调用与Nexus进行交互。 For 'create repository' action, I want to redirect the user to the Nexus 3 page create repository page. 对于“创建存储库”操作,我想将用户重定向到Nexus 3页面的“创建存储库”页面。

Create Repository requires an authenticated user. 创建存储库需要经过身份验证的用户。 I understand we can make API calls which include an user information and authenticate and achieve this. 我了解我们可以进行包含用户信息的API调用并进行身份验证并实现这一目标。 But as I want to redirect them to the Nexus 3 page. 但是,由于我想将它们重定向到Nexus 3页面。

There I do not want the user to authenticate again. 在那里,我不希望用户再次进行身份验证。 Is it possible that we can redirect the user to nexus page as an authenticated user? 我们是否可以将用户作为经过身份验证的用户重定向到联系页面?

First of all, this is doable . 首先,这是可行的 As a first step, we need to authenticate our user from our application with nexus 3 and obtain one time token for the user. 第一步,我们需要使用nexus 3从我们的应用程序对用户进行身份验证,并为该用户获取一个时间令牌。 You can follow this guide to achieve that http://blog.sonatype.com/nexus-repository-new-beta-rest-api-for-content . 您可以按照本指南来实现http://blog.sonatype.com/nexus-repository-new-beta-rest-api-for-content

Note: Nexus 3 API are still in beta. 注意:Nexus 3 API仍处于测试阶段。

Once we obtain the token, the job becomes simpler. 一旦获得令牌,工作将变得更加简单。 In all the APIs you send, we have to add the token and loggedIn attribute. 在您发送的所有API中,我们必须添加令牌和loggingIn属性。

For example, 例如,

http://nexus3_domain?sfLoginToken=#{one_time_token}&isLoggedIn=true/#browse/browse:Test

And the user is now redirected to the repo Test as an authenticated user. 现在,该用户已通过身份验证的用户重定向到回购测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如果用户未使用Devise进行身份验证,则重定向到登录页面 - Redirect to log in page if user is not authenticated with Devise 未验证用户身份时如何重定向到登录页面 - How redirect to a sign in page when the user is not authenticated Rails 4 devise-如果未通过身份验证,则重定向用户 - Rails 4 devise - redirect user if not authenticated 如何:当用户无法通过身份验证时重定向到特定页面(设计 rails gem) - How To: Redirect to a specific page when the user can not be authenticated (devise rails gem) 尝试在未经Rails认证的情况下访问页面后将用户重定向到root用户 - Redirect user to root after trying to access a page without being authenticated to do so in rails 如果任何模型(来自各种模型)未通过设计验证,则重定向到特定页面 - Redirect to specific page if any model (from various) is not authenticated with Devise 切换到HTTPS页面时保持用户身份验证-Devise&Heroku - Keeping user authenticated when switching to HTTPS page - Devise & Heroku 使用Rails 3将用户重定向到特定页面 - redirect user to a specific page with rails 3 如果用户未登录,则重定向到登录页面 - redirect to login page if user not logged in 用户登录后页面重定向 - Page redirect after user logs in
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM