Perforce: About your session have expired, please login again workaround-Alibaba Cloud

Using the Perforce API to sync files on the server, it is found that after 12 hours it is always reported that "Your session has expired, please login again" error, check the user name and password are correct, Code is written according to Perforce example, there is no problem, but it is not logged in, even if the Connection.login function is called, the same can not log in.

Finally, after countless attempts, the discovery is related to the security level settings of the server.

When the security level of the server is 3, it is not possible to log in directly by setting the password method in option, i.e.:

Connection con = Rep. Connection;

Options options = new options ();
options["Password"] = "Password";

Con. Login ("Password", options);

If this code is written, even if the password passed to the login function is correct, you cannot log in because the security level of the server is set to 3, and if the password field in the options is found to have a value, the connection request is rejected directly.

Therefore, the code needs to be changed to:

Connection con = Rep. Connection;

Options options = new options ();

Con. Login ("Password", options);

Or simply do not option:

Connection con = Rep. Connection;

Options options = new options ();

Con. Login ("password", null);

This will allow you to successfully log on to the server.

Appendix A description of the security level in Perforce server:

-----------------------------------------------------------------------------

Server security Levels
Perforce superusers can configure server-wide password usage

requirements, password strength enforcement, and supported

Methods of User/server authentication by setting the security

Counter. To change the security counter, issue the command:

P4 counter-f Security Seclevel
Where Seclevel is 0, 1, 2, or 3. After setting the counter, stop

and restart the server.

Choosing a server Security level
The default security level is 0:passwords was not required, and

Password strength is not enforced.
To ensure the all users has passwords, use security Level 1.

Users of old client programs can still enter weak passwords.

To ensure the all users has strong passwords, use security

Level 2. Old Perforce Software continues to work, but users of

Old Perforce client software must change their password to a

Strong password by using a Perforce client program at Release

2003.2 or above.

To require the all users has strong passwords, and to require

The use of session-based authentication, use security Level 3 and

Current Perforce client software.

Level 0 corresponds to pre-2003.2 server operation. Levels 1 and

2 were designed for support of Legacy Client software. Level 3

Affords the highest degree of security.

The Perforce server security levels and their effects on the

Behavior of Perforce client programs is defined below.

Security level
Server behavior
0
(or unset)
Legacy Support:passwords is not required. If Passwords is

Used, password strength is not enforced.

Users with passwords can use either their p4passwd setting or the

P4 login command for ticket-based authentication.

Users of old Perforce client programs is unaffected.
1
Strong passwords is required for users of post-2003.2 Perforce

Client programs, but existing passwords is not reset.

Pre-2003.2 Perforce client programs can set passwords with P4

passwd or in the P4 user form, but password strength are not

Enforced.

Users with passwords can use either their p4passwd setting or the

P4 login command for ticket-based authentication.
2
All unverified strength passwords must is changed.

Users of pre-2003.2 client programs cannot set passwords.

Users of the client programs at release 2003.2 or higher must use P4

passwd and enter their passwords at the prompt. Setting passwords

With the P4 user form or the P4 passwd-o oldpass-p Newpass

command is prohibited.

On Windows, passwords is no longer stored in (or read from) the

Registry. (Storing p4passwd as an environment variable are

Supported, but passwords set with P4 set P4PASSWD is ignored.)

The Users who has set strong passwords with a 2003.2 or higher

Perforce client program can use either their p4passwd setting for

password-based authentication, or the P4 login command for

ticket-based authentication.
3
All password-based authentication are rejected.

Users must use ticket-based authentication (P4 login).

If You have scripts this rely on passwords, use the P4 login to

Create a ticket valid for the user running the script, or use P4

Login-p to display the value of a ticket that can is passed to

Perforce commands as though it were a password (that's, either

From the command line, or by setting P4PASSWD to the value of the

Valid ticket).

Password Strength
Certain combinations of server security level and Perforce client

Software releases require users to set "strong" passwords. A

Password is considered strong if it's at least eight characters

Long, and at least, the following is true:

The password contains uppercase letters.

The password contains lowercase letters.

The password contains nonalphabetic characters.

For example, the passwords a1b2c3d4, A1B2C3D4, ABCDEFGH is

Considered strong.

Related Article:

Principles and solutions of how to keep the SESSION not expired in PHP

Asp.net session usage and expired instance code

               

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值