露天门票有效期

发布于 2024-12-04 16:35:30 字数 144 浏览 1 评论 0 原文

我正在使用 alfresco 默认 Web 脚本为用户获取票证,但我不确定获得的票证何时有效。

我还从 alfresco 默认登录 Web 脚本获得的 XML 响应中提取票证。

票证是否有有效期,或者一旦获得票证,它就不会在会话到期之前过期?

I am using alfresco default web script to get a ticket for a user but i am not sure till when this obtained ticket is valid.

Also i am extracting ticket is from obtained XML response of alfresco default login web script.

Does a ticket has any expiry date or once a ticket is obtained, it will not expire till session expiry?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

何以心动 2024-12-11 16:35:30

Alfresco 存储库上设置的以下属性及其默认值将票证有效期配置为一小时:

authentication.ticket.validDuration=P1H

您可以在 通常的方式。有意义的值在 Duration 类:

 * The lexical representation of duration is
 * PnYnMnDTnHnMnS.
 * 
 * P is a literal value that starts the expression
 * nY is an integer number of years followed by the literal Y
 * nM is an integer number of months followed by the literal M
 * nD is an integer number of days followed by the literal D
 * T is the literal that separates the date and time
 * nH is an integer number of hours followed by a literal H
 * nM is an integer number of minutes followed by a literal M
 * nS is a decimal number of seconds followed by a literal S

请注意,默认情况下,成功使用票证将更新其有效性,这意味着如果您对 Web 脚本进行身份验证,则票证有效期为一小时称呼票券生成后59m后使用,其有效期将延长一小时。

由于票证生命周期是完全可配置的,因此请查看 authentication-services-context.xml 中定义的 ticketComponent Spring bean 以查看可用选项(例如设置 oneOff 设置为 true 以仅允许给定票证使用一次)。

The following property set on the Alfresco repository, along with its default value, configures the ticket life span to be one hour:

authentication.ticket.validDuration=P1H

You can override such property in the usual way. Meaningful values are described in the Duration class:

 * The lexical representation of duration is
 * PnYnMnDTnHnMnS.
 * 
 * P is a literal value that starts the expression
 * nY is an integer number of years followed by the literal Y
 * nM is an integer number of months followed by the literal M
 * nD is an integer number of days followed by the literal D
 * T is the literal that separates the date and time
 * nH is an integer number of hours followed by a literal H
 * nM is an integer number of minutes followed by a literal M
 * nS is a decimal number of seconds followed by a literal S

Please note that by default successful usages of a ticket will renew its validity, meaning that given a ticket validity of one hour, if you authenticate, say, a web script call using the ticket after 59m from its generation, its validity will be extended to another hour.

As the ticket lifecycle is completely configurable, have a look at the ticketComponent Spring bean defined in authentication-services-context.xml to see the available options (e.g. setting oneOff to true to only allow one single use of a given ticket).

匿名。 2024-12-11 16:35:30

处理露天身份验证票证的最佳方法是手动处理。例如,要获取门票,请使用 OOTB Web 脚本。

http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin 

其中返回票证如 TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9 (需要提取)。

现在,当使用此票证进行任何类型的操作时,请尝试使用 OOTB alfresco Web 脚本验证票证有效性。请注意,这是基于 HTTP GET 方法的 Web 脚本

GET /alfresco/service/api/login/ticket/{ticket}

http://localhost:8080/alfresco/service/api/login/ticket/TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9?alf_ticket=TICKET_29ced6613a114294fa4bb9e67b663112076f3d9

这里需要注意的是,您需要进行身份验证此 Web 脚本还附加了 ?alf_ticket={ALFRESCO_TICKET} ,否则它将无法工作。

最后,当您完成所有操作后,请始终使用 OOTB alfresco 注销 Web 脚本注销。请注意,这是一个基于 HTTP DELETE 方法的 Web 脚本

DELETE /alfresco/service/api/login/ticket/{ticket}).

http://localhost:8080/alfresco/service/api/login/ticket/TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9?alf_ticket=TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9

,您还需要通过附加 ?alf_ticket={ALFRESCO_TICKET} 来验证此 Web 脚本,否则它将无法工作。

通过这种方式,您可以确保正确的身份验证,并且系统不会因为过时的票证而负担过重。

PS http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Logout

The best way to handle alfresco authentication tickets is to handle it manually. E.g. for getting a ticket, use OOTB web script.

http://localhost:8080/alfresco/service/api/login?u=admin&pw=admin 

which return ticket such as TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9 (needs to be extracted).

Now when using this ticket for any kind of operation, try to verify ticket validity using OOTB alfresco web script.Note that this is a HTTP GET method based web script

GET /alfresco/service/api/login/ticket/{ticket}

http://localhost:8080/alfresco/service/api/login/ticket/TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9?alf_ticket=TICKET_29ced6613a114294fa4bb9e67b663112076f3d9

Thing to note here is that you need to authenticate this web script also by appending ?alf_ticket={ALFRESCO_TICKET} without which it will not work.

Finally when you are done with your things, always log out using OOTB alfresco logout web script. Note that this is a HTTP DELETE method based web script

DELETE /alfresco/service/api/login/ticket/{ticket}).

http://localhost:8080/alfresco/service/api/login/ticket/TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9?alf_ticket=TICKET_29ced6613a114294fa4bb9e67bf663112076f3d9

Again you need to authenticate this web script also by appending ?alf_ticket={ALFRESCO_TICKET} without which it will not work.

This way you can ensure proper authentication as well as system will not be overburdened with stale tickets.

P.S. http://wiki.alfresco.com/wiki/Repository_RESTful_API_Reference#Logout

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文