josso 用户登录验证(以oracle 10g为例)

来源:互联网 发布:知和行书局 编辑:程序博客网 时间:2024/05/17 09:07

对与oracle中用户登录数据库的创建请参考上篇写的“joss数据库的创建”。

1Configure Identity Store

因为我们正在使用的数据库管理系统存在的身份信息,你应该已经安装使用的门户-持续分贝的选择。这将安装josso-gateway-db-stores.xml文件已经预先分贝身份商店。

让我们来看看在组件配置:

josso-gateway-db-stores.xml

<?xml version="1.0" encoding="UTF-8"?>

<s:beans xmlns:s="http://www.springframework.org/schema/beans"

         xmlns:db-istore="urn:org:josso:db:identitystore"

         xmlns:memory-istore="urn:org:josso:memory:identitystore"

         xmlns:db-sstore="urn:org:josso:db:sessionstore"

         xmlns:memory-sstore="urn:org:josso:memory:sessionstore"

         xmlns:db-astore="urn:org:josso:db:assertionstore"

         xmlns:memory-astore="urn:org:josso:memory:assertionstore"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="

        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd

        urn:org:josso:db:identitystore http://www.josso.org/schema/josso-db-identitystore.xsd

        urn:org:josso:memory:identitystore http://www.josso.org/schema/josso-memory-identitystore.xsd

        urn:org:josso:db:sessionstore http://www.josso.org/schema/josso-db-sessionstore.xsd

        urn:org:josso:memory:sessionstore http://www.josso.org/schema/josso-memory-sessionstore.xsd

        urn:org:josso:db:assertionstore http://www.josso.org/schema/josso-db-assertionstore.xsd

        urn:org:josso:memory:assertionstore http://www.josso.org/schema/josso-memory-assertionstore.xsd

        "

        >

<db-istore:jdbc-store

            id="josso-identity-store"

            driverName="oracle.jdbc.driver.OracleDriver"

            connectionURL="jdbc:oracle:thin:@localhost:1521:orcl"

            connectionName="openldaptest"

            connectionPassword="123456"

            userQueryString="SELECT LOGIN AS NAME FROM JOSSO_USER WHERE LOGIN = ?"

            rolesQueryString="SELECT NAME AS ROLE FROM JOSSO_USER_ROLE WHERE LOGIN = ?"

            credentialsQueryString="SELECT LOGIN AS USERNAME, PASSWORD FROM JOSSO_USER WHERE LOGIN = ?"

            userPropertiesQueryString="SELECT NAME, VALUE FROM JOSSO_USER_PROPERTY WHERE LOGIN = ?"

            resetCredentialDml="UPDATE JOSSO_USER SET PASSWORD = ? WHERE LOGIN = ?"

            relayCredentialQueryString="SELECT LOGIN FROM JOSSO_USER WHERE #?# = ?"

            />

 

<memory-sstore:memory-store id="josso-session-store"/>

<memory-astore:memory-store id="josso-assertion-store"/>

</s:beans>

注:JDBC Driver

请确认您已列入数据库驱动程序中的JOSSO网关。您可以品牌网关或复制驱动到已部署的josso war 下的WEB-INF/lib目录下。

2Include DB Identity Stores

修改网关主要配置,请务必包括您的配置文件:

例如,您可以像这样:

josso-gateway-config.xml

<!-- Identity, Session and Assertion Stores configuration -->

    <s:import resource="josso-gateway-db-stores.xml" />

<!--

    <s:import resource="josso-gateway-memory-stores.xml" />

    <s:import resource="josso-gateway-stores.xml" />

    <s:import resource="josso-gateway-ldap-stores.xml" />

 -->

3Configure the Basic Authentication Scheme

现在我们的身份存储配置,我们必须安装的基本身份验证计划。在这种情况下,我们将删除hasAlgorithmhasEnconding属性,因为在我们的范例,密码都存储在纯文本。该认证计划的配置中可以找到josso-gateway-auth.xml文件。josso-gateway-auth.xml

<basic-authscheme:basic-auth-scheme

        id="josso-basic-authentication"

        ignorePasswordCase="false"

        ignoreUserCase="false">

 

    <basic-authscheme:credentialStore>

        <s:ref bean="josso-identity-store"/>

    </basic-authscheme:credentialStore>

 

    <basic-authscheme:credentialStoreKeyAdapter>

        <s:ref bean="josso-simple-key-adapter"/>

    </basic-authscheme:credentialStoreKeyAdapter>

 

</basic-authscheme:basic-auth-scheme>

4Test it

Now you can redeploy your branded gateway and try this changes. If you altered a standard JOSSO Gateway you probably only need to restart the container.现在,您可以重新部署您的品牌网关并尝试这个变化。如果改变了一个标准的JOSSO网关你可能只需要重新启动容器。

原创粉丝点击