Enabling persistent sessions in a single store(WebSphere Commmerce Remenber Me)

本文详细介绍了如何在IBM WebSphere Commerce中启用持久会话,特别是对于消费者直接商店,通过记住用户的登录状态,从而提高用户体验。文章包括了在登录表单和用户注册添加表单中添加必要的参数,以及如何修改URL参数和配置文件来实现持久会话的功能。
http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.admin.doc/tasks/tsecremem_cd.htm


Securing > Session management > Using cookies for session management > Persistent sessions (Remember Me)

Feedback
Enabling persistent sessions in a single store

Persistent sessions are particularly useful in consumer direct stores, although it is possible to enable B2B direct stores with persistent sessions as well. The steps to enable persistent sessions in the stores only differ in the locations and names of the files that need to be altered. In both cases, the store's Logon and UserRegistrationAdd forms require changes. The steps must be performed for all the stores in the site that need persistent sessions.
Before you begin
Ensure that you have completed the following task:

Enabling persistent sessions globally.

Procedure

In your store's Logon form and the UserRegistrationAdd form, add the rememberMe parameter as shown in the following example:

<form method="post" name="Logon" action="Logon" id="Logon">
...
<input type="checkbox" name="rememberMe" value="true">
Remember Me </input>
...
</form>

Modify the URL parameter of the Logon form from

<input type="hidden" name="URL"
value="OrderItemMove?page=account&URL=OrderCalculate%3FURL%3DLogonForm"
id="WC_Accouid="WC_AccountDisplay_FormInput_URL_In_Logon_1" />

to

<c:choose>

<c:when test="${!empty WCparam.URL}">
<input type="hidden" name="URL"
value="${WCparam.URL}"
id="WC_AccountDisplay_FormInput_URL_In_Logon_1" />
</c:when>
<c:otherwise>
<input type="hidden" name="URL"
value="OrderItemMove?page=account&URL=OrderCalculate%3FURL%3DLogonForm"
id="WC_AccountDisplay_FormInput_URL_In_Logon_1" />
</c:otherwise>
</c:choose>

Note: The value of the id attribute will differ between stores, but the structure of the code fragment will remain consistent.
Optionally, If you want the partially authenticated user's logon ID to be pre-populated in the user name entry field of the logon form, change the following code:

<input size="20" name="logonId" value=""
id="WC_AccountDisplay_FormInput_logonId_In_Logon_1" />

to:

<c:choose>
<c:when test="${!empty param.logonId}">
<input size="20" name="logonId" value="${param.logonId}"
id="WC_AccountDisplay_FormInput_logonId_In_Logon_1" />
</c:when>
<c:otherwise>
<input size="20" name="logonId" value=""
id="WC_AccountDisplay_FormInput_logonId_In_Logon_1" />
</c:otherwise>
</c:choose>

Note: The value of the id attribute will differ between stores, but the structure of the code fragment will remain consistent.
Add the following configuration fragment to the WebSphere Commerce Struts custom configuration file for the Stores module:

<global-forwards>
<forward className="com.ibm.commerce.struts.ECActionForward"
name="RememberMeLogonFormView/
storeID"

path="/UserArea/AccountSection/LogonSubsection/LogonSetup.jsp">

<set-property property="credentialsAccepted"
value="
storeID:
credAccept" />
</forward>

</global-forwards>

<action-mappings
type="com.ibm.commerce.struts.ECActionMapping">

<action path="/RememberMeLogonFormView"
type="com.ibm.commerce.struts.BaseAction">
<set-property property="https" value="
storeID:1" />
<set-property property="credentialsAccepted" value="
storeID:
credAccept" />
</action>

</action-mappings>

Where:

storeID
The store ID of the store for which you are enabling the persistent session. This value can be found in the STORE table.
credAccept
P to mean that remembered registered users are entitled to accessing this resource without authenticating themselves, or any other value (including NULL) to mean that they must authenticate themselves.

Update actions for all the URLs that remembered registered users are entitled to access without authenticating themselves by setting their credentialsAccepted property to storeID :P.
Update the PERSISTENTSESSION column in the STORE table in order to enable the persistent session:
Open a session to your database.
Find the STORE_ID of the store you are enabling persistent session for by entering the following SQL statement into the session:

SELECT * FROM STORE

Enter the following SQL statement into your database:

UPDATE STORE SET PERSISTENTSESSION =
configValue WHERE STORE_ID =
store
ID


Where:

storeID
The ID of the store for which you are enabling persistent session.
configValue
A value from the following list that represents the appropriate configuration:

0
The rememberMe function is disabled for registered customers and guest customers. This is the default value.
1
The rememberMe function is enabled for registered customers only.
2
The rememberMe function is enabled for guest customers only.
3
The rememberMe function is enabled for registered customers and guest customers.

Related concepts:
Users
Session management
Persistent sessions (Remember Me)
Personalization ID
time stampLast updated: 18 April 2013 Tweet
Topic URL: http://pic.dhe.ibm.com/infocenter/wchelp/v7r0m0/topic/com.ibm.commerce.admin.doc/tasks/tsecremem_cd.htm Share
<think>我们正在配置网络设备(交换机配置为路由器)并需要设置通过指定接口登录设备的功能(例如Telnet服务),然后再启用服务。这通常是为了增强安全性,限制只有特定接口可以接收管理流量(如Telnet登录请求)。 根据网络设备配置的通用原则(以Cisco IOS为例,但概念适用于多数厂商设备): 1. 我们需要为设备配置一个IP地址(在某个接口上),作为管理地址。 2. 然后配置Telnet服务(或其他远程登录服务)监听指定的接口(或所有接口)。 3. 通过访问控制列表(ACL)或类似机制,限制只有指定的接口可以接受Telnet连接请求。 但是,用户要求的是“配置通过指定接口登录设备的功能”,然后再启用服务。我们可以理解为:在启动Telnet服务之前,先设置Telnet服务只绑定在指定的接口上(而不是所有接口),这样只有连接到该指定接口的设备才能尝试登录。 以下是步骤(以Cisco设备为例,假设我们使用Loopback0接口作为管理接口,IP地址为192.168.1.1,并且只允许通过该接口进行Telnet登录): **步骤1:创建并配置管理接口** ```bash interface Loopback0 ip address 192.168.1.1 255.255.255.0 no shutdown ``` **步骤2:配置VTY线路,并指定源接口(即只接受来自该接口的登录请求)** 在Cisco IOS中,我们可以使用`transport input`命令来指定允许的协议(如Telnet),并使用`vty`线路配置下的`bind`命令(某些版本)或通过访问控制列表(ACL)来限制访问的源地址。但是,更常见的做法是使用ACL来限制哪些IP地址可以访问VTY线路。 然而,用户要求的是“指定接口”,我们可以理解为:只允许从该接口的IP地址来接受连接。实际上,Telnet服务是绑定在设备的IP地址上的,而每个IP地址都关联一个接口。如果我们想让Telnet服务只在某个接口上监听,我们需要确保该服务只绑定在该接口的IP地址上。 在较新的IOS版本中,可以通过以下方式: ```bash line vty 0 4 login local transport input telnet bind interface only Loopback0 # 这条命令可能因设备而异,有些设备不支持 ``` 但是,更通用且广泛支持的方法是使用ACL来限制: - 首先创建一个ACL,只允许访问管理接口的IP地址(如果管理接口是Loopback0,那么允许目的地址为192.168.1.1的流量?注意:ACL通常用于过滤进入的流量,所以应该是源地址的限制?实际上,我们要限制的是哪些源IP地址可以连接VTY,但这里的要求是“通过指定接口登录”,即从指定接口进来的登录请求。但更安全的做法是限制源IP地址段,比如只允许管理网络的IP访问。 如果我们想限制只有从某个接口(例如物理接口GigabitEthernet0/0)进来的Telnet请求,我们可以为该接口配置一个IP地址,然后配置一个ACL,允许源地址为该接口所在网段的设备访问,并将该ACL应用到VTY线路上。 另一种思路:我们不需要全局禁用Telnet服务,而是通过绑定服务到指定接口的IP地址。在Cisco IOS中,默认情况下,Telnet服务会监听所有接口的IP地址。我们可以通过配置命令移除其他接口的Telnet服务绑定,但这不是标准的做法。 因此,我们采用ACL方案: **步骤1:配置管理接口(同上)** **步骤2:创建ACL,定义允许登录的源地址(可以是整个管理网络)** ```bash ip access-list standard TELNET-ACCESS permit 192.168.1.0 0.0.0.255 # 允许管理网络 deny any ``` **步骤3:在VTY线路上应用该ACL** ```bash line vty 0 4 access-class TELNET-ACCESS in # 限制入站连接 login local transport input telnet ``` 这样,只有来自192.168.1.0/24网段的设备才能通过Telnet登录。 但是,用户要求的是“通过指定接口登录”,如果我们希望只有通过某个特定接口(比如GigabitEthernet0/0)接入的设备才能登录,那么我们可以通过限制源IP地址为该接口所在网段来实现。例如,如果接口GigabitEthernet0/0配置的IP网段是10.1.1.0/24,那么ACL改为: ```bash ip access-list standard TELNET-ACCESS permit 10.1.1.0 0.0.0.255 deny any ``` 这样就实现了只有从接口GigabitEthernet0/0所在网络接入的设备才能Telnet登录。 **步骤4:验证配置** 验证方法: 1. 使用`show running-config | section line vty`查看VTY配置。 2. 使用`show ip access-lists`查看ACL是否有匹配计数(当有尝试连接时)。 3. 从允许的网段和禁止的网段分别尝试Telnet连接测试。 注意:在配置完成并且验证无误之后再启用Telnet服务(实际上,在配置完VTY线路后Telnet服务就已经启用了)。如果之前已经启用了Telnet,那么配置过程中服务是持续的。 对于其他厂商的设备(如华为),配置思路类似,具体命令不同。华为设备可以使用ACL,然后在用户界面(user-interface)下应用ACL。 因此,总结配置步骤: 1. 选择用于管理的接口,并配置IP地址。 2. 创建访问控制列表(ACL),允许来自指定接口所在网络的流量(或者更精确的源地址范围)。 3. 在远程登录服务(如Telnet)的线路上应用该ACL(入方向)。 4. 配置登录认证方式(如用户名密码)。 最后再启用服务(默认配置完VTY就已经启用了,如果没有启用,使用`telnet server enable`命令启用)。 注意:上述配置中,我们并没有在全局禁用Telnet服务,而是通过ACL限制了访问来源。这样既实现了只允许指定接口网络的管理登录,又避免了服务完全不可用的情况。 参考文档:Cisco官方配置指南[^1]。 </think>### 配置通过指定接口登录设备的方法 在启用服务(如Telnet)前限制登录接口可增强设备安全性。以下是基于网络设备配置的标准流程(以Cisco设备为例): #### 步骤1: 创建访问控制列表(ACL) 定义允许登录的源地址范围: ```bash ip access-list standard MGMT-ACCESS permit 192.168.10.0 0.0.0.255 # 仅允许管理网段 deny any log # 拒绝其他地址并记录日志 ``` #### 步骤2: 配置VTY线路绑定 将ACL应用到虚拟终端线路,限制访问来源: ```bash line vty 0 4 access-class MGMT-ACCESS in # 应用入站ACL transport input telnet # 启用Telnet协议 login local # 本地认证 exit ``` #### 步骤3: 配置接口IP(关键步骤) 为指定管理接口配置IP地址(例如GigabitEthernet0/0): ```bash interface GigabitEthernet0/0 ip address 192.168.10.1 255.255.255.0 no shutdown ``` > **注意**:设备只会响应配置了IP地址的接口的登录请求[^1] #### 步骤4: 启用Telnet服务 ```bash telnet server enable # 显式启用服务 service password-encryption # 加密密码 ``` #### 验证配置: 1. **检查接口状态**: ```bash show ip interface brief | include GigabitEthernet0/0 ``` 输出示例: ``` Gi0/0 192.168.10.1 YES manual up up ``` 2. **测试登录限制**: - 从允许网段(192.168.10.*)连接应成功 - 从其他网段连接应被拒绝,并生成日志: ``` %SEC-6-IPACCESSLOGP: list MGMT-ACCESS denied 10.1.1.5 0 packets ``` #### 高级安全建议: 1. **服务绑定**(如华为设备): ```bash telnet server bind 192.168.10.1 # 绑定到特定IP ``` 2. **日志监控**: ```bash logging host 192.168.10.100 # 发送日志到Syslog服务器 ``` 3. **备用方案**(当ACL不可用时): ```bash line vty 0 4 ip access-group MGMT-ACCESS in # 部分设备替代语法 ``` > **关键原理**:设备通过接口IP地址响应服务请求。未配置IP的接口不会响应Telnet连接尝试[^1]。此配置实现了: > - 访问控制方程:$ \text{Access} = \begin{cases} 1 & \text{if } \text{src\_ip} \in \text{MGMT\_NET} \\ 0 & \text{otherwise} \end{cases} $ > - 安全策略:$ \text{Service} \cap \text{Interface}_{\text{specified}} $
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值