[ 
https://issues.apache.org/jira/browse/KNOX-1214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16404670#comment-16404670
 ] 

Phil Zampino commented on KNOX-1214:
------------------------------------

Since we've started actually parsing the XML from referenced provider 
configurations, the attribute-style parameters are no longer supported. (At the 
time of the demo, there was no parsing/validation of XML provider 
configurations).

Only the element-style parameter specification is supported for XML. Also, 
please note that JSON and YAML formats are now supported for describing 
provider configurations.

e.g., JSON

{code:java}
{
  "providers": [
    {
      "role": "authentication",
      "name": "ShiroProvider",
      "enabled": "true",
      "params": {
        "sessionTimeout": "30",
        "main.ldapRealm": "org.apache.knox.gateway.shirorealm.KnoxLdapRealm",
        "main.ldapContextFactory": 
"org.apache.knox.gateway.shirorealm.KnoxLdapContextFactory",
        "main.ldapRealm.contextFactory": "$ldapContextFactory",
        "main.ldapRealm.userDnTemplate": 
"uid={0},ou=people,dc=hadoop,dc=apache,dc=org",
        "main.ldapRealm.contextFactory.url": "ldap://localhost:33389";,
        "main.ldapRealm.contextFactory.authenticationMechanism": "simple",
        "urls./**": "authcBasic"
      }
    },
    {
      "role":"hostmap",
      "name":"static",
      "enabled":"true",
      "params":{
        "localhost":"sandbox,sandbox.hortonworks.com"
      }
    },
    {
      "role":"ha",
      "name":"HaProvider",
      "enabled":"true",
      "params":{
 
"WEBHDFS":"maxFailoverAttempts=3;failoverSleep=1000;maxRetryAttempts=300;retrySleep=1000;enabled=true",
        "HIVE":"maxFailoverAttempts=3;failoverSleep=1000;enabled=true"
      }
    }
  ]
}
{code}


e.g., YAML
{code:java}
---
providers:
  - role: authentication
    name: ShiroProvider
    enabled: true
    params:
      sessionTimeout: 30
      main.ldapRealm: org.apache.hadoop.gateway.shirorealm.KnoxLdapRealm
      main.ldapContextFactory: 
org.apache.hadoop.gateway.shirorealm.KnoxLdapContextFactory
      main.ldapRealm.contextFactory: $ldapContextFactory
      main.ldapRealm.userDnTemplate: 
uid={0},ou=people,dc=hadoop,dc=apache,dc=org
      main.ldapRealm.contextFactory.url: ldap://localhost:33389
      main.ldapRealm.contextFactory.authenticationMechanism: simple
      urls./**: authcBasic
  - role: hostmap
    name: static
    enabled: true
    params:
      localhost: sandbox,sandbox.hortonworks.com
  - role: ha
    name: HaProvider
    enabled: true
    params:
      WEBHDFS: 
maxFailoverAttempts=3;failoverSleep=1000;maxRetryAttempts=300;retrySleep=1000;enabled=true
      HIVE: maxFailoverAttempts=3;failoverSleep=1000;enabled=true
{code}




> Service Discovery : If the provider xml is configured with attributes for 
> param tag , then the xml is not read properly
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: KNOX-1214
>                 URL: https://issues.apache.org/jira/browse/KNOX-1214
>             Project: Apache Knox
>          Issue Type: Bug
>    Affects Versions: 0.14.0
>            Reporter: J.Andreina
>            Priority: Critical
>             Fix For: 1.1.0
>
>         Attachments: provider.xml, ui.xml
>
>
>  If the provider xml is configured with attributes for param tag , then the 
> xml is not read properly
> For example configured as below for provider.xml
> {noformat}
> <gateway>
>     <provider>
>         <role>authentication</role>
>         <name>ShiroProvider</name>
>         <enabled>true</enabled>
>         <param name="sessionTimeout" value="30"/>
>      </provider>
> </gateway>   
> {noformat}
> instead of configuring as child for param nodes as below
> {noformat}
> <gateway>
>     <provider>
>         <role>authentication</role>
>         <name>ShiroProvider</name>
>         <enabled>true</enabled>
>            <param>
>                 <name>sessionTimeout</name>
>                 <value>30</value>
>             </param>
>      </provider>
> </gateway>   
> {noformat}
> {color:red}Generated Topology content{color}
> {noformat}
> <topology>
>     <generated>true</generated>
>     <gateway>
>         <provider>
>             <role>authentication</role>
>             <name>ShiroProvider</name>
>             <enabled>true</enabled>
>             <param>
>                 <name>null</name>
>                 <value>null</value>
>             </param>
>         </provider>
>     </gateway>
> {noformat}
> {color:red}Note:{color}
> In the feature documentation also "name" and "value" are mentioned as 
> attributes for param tag.
> *Log:*
> {noformat}
> 2018-03-19 06:44:31,662 ERROR env.EnvironmentLoader 
> (EnvironmentLoader.java:initEnvironment(146)) - Shiro environment 
> initialization failed
> org.apache.shiro.config.ConfigurationException: Shiro INI configuration was 
> either not found or discovered to be empty/unconfigured.
>         at 
> org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:87)
>         at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
>         at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
>         at 
> org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to