We've enabled sdnr-oauth-provider and setted up Keycloak for authentication 
into SDNC. Communication with SDNR server works just fine after authentication 
in its web interface (ODLUX).
But when we send requests to netconf client (/rests/operations/...) we receive 
an error:

{
"cause2":"java.lang.NullPointerException",
"cause1":"javax.servlet.ServletException: Filtered request failed.",
"servlet":"org.glassfish.jersey.servlet.ServletContainer",
"cause0":"javax.servlet.ServletException: javax.servlet.ServletException: 
Filtered request failed.",
"message":"javax.servlet.ServletException: javax.servlet.ServletException: 
Filtered request failed.",
"url":"/rests/operations/data-provider:read-network-element-connection-list",
"status":"500"
}

Looks like it happens because SecurityManager in Shiro bundle is 'null' but it 
happens somewhere inside OpenDaylight AAA project. OpenDaylight AAA 
documentation says that main Shiro configuration file called shiro.ini should 
be located in "etc" folder in Karaf main directory but there is no such file. 
Has anyone faces same error? See our oauth-aaa-app-config.xml and 
oauth-provider.config.json attached.

oauth-provider.config.json: |
{
"tokenSecret": "DLbRfXxLeQnebspNauSA",
"tokenIssuer": "ONAP SDNC",
"publicUrl": "https://192.168.58.143:30205";,
"redirectUri": "/odlux/index.html#/oauth?token=",
"supportOdlUsers": "true",
"providers": 
[{"clientId":"onap-client","url":"http://192.168.58.143:30651","id":"keycloak","scope":"openid","secret":"KhDvJmXlOMfOXnkdovSHHLwSS3iL7SR7","title":"ONAP
 Keycloak 
Provider","type":"KEYCLOAK","realmName":"onap","trustAll":true,"roleMapping":{"admin":"admin@sdn"}}]
}


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#24403): https://lists.onap.org/g/onap-discuss/message/24403
Mute This Topic: https://lists.onap.org/mt/98317355/21656
Mute #jakarta:https://lists.onap.org/g/onap-discuss/mutehashtag/jakarta
Mute #kohn:https://lists.onap.org/g/onap-discuss/mutehashtag/kohn
Mute #aaf:https://lists.onap.org/g/onap-discuss/mutehashtag/aaf
Mute #ccsdk:https://lists.onap.org/g/onap-discuss/mutehashtag/ccsdk
Group Owner: onap-discuss+ow...@lists.onap.org
Unsubscribe: https://lists.onap.org/g/onap-discuss/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


<?xml version="1.0" ?>
<!--
  ~ ============LICENSE_START=======================================================
  ~ ONAP : ccsdk features
  ~ ================================================================================
  ~ Copyright (C) 2021 highstreet technologies GmbH Intellectual Property.
  ~ All rights reserved.
  ~ ================================================================================
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~ ============LICENSE_END=======================================================
  ~
  -->

<shiro-configuration xmlns="urn:opendaylight:aaa:app:config">


    <main>
        <pair-key>tokenAuthRealm</pair-key>
        <pair-value>org.onap.ccsdk.features.sdnr.wt.oauthprovider.OAuth2Realm</pair-value>
    </main>

    <main>
        <pair-key>securityManager.realms</pair-key>
        <pair-value>$tokenAuthRealm</pair-value>
    </main>
    <!-- Used to support OAuth2 use case. -->
    <main>
        <pair-key>authcBasic</pair-key>
        <pair-value>org.opendaylight.aaa.shiro.filters.ODLHttpAuthenticationFilter</pair-value>
    </main>
    <main>
        <pair-key>anyroles</pair-key>
        <pair-value>org.opendaylight.aaa.shiro.filters.AnyRoleHttpAuthenticationFilter</pair-value>
    </main>
    <main>
        <pair-key>authcBearer</pair-key>
        <pair-value>org.opendaylight.aaa.shiro.filters.ODLHttpAuthenticationFilter2</pair-value>
    </main>

    <!-- in order to track AAA challenge attempts -->
    <main>
        <pair-key>accountingListener</pair-key>
        <pair-value>org.opendaylight.aaa.shiro.filters.AuthenticationListener</pair-value>
    </main>
    <main>
        <pair-key>securityManager.authenticator.authenticationListeners</pair-key>
        <pair-value>$accountingListener</pair-value>
    </main>

    <!-- Model based authorization scheme supporting RBAC for REST endpoints -->
    <main>
        <pair-key>dynamicAuthorization</pair-key>
        <pair-value>org.opendaylight.aaa.shiro.realm.MDSALDynamicAuthorizationFilter</pair-value>
    </main>


    <urls>
        <pair-key>/**/operations/cluster-admin**</pair-key>
        <pair-value>authcBearer, roles[admin]</pair-value>
    </urls>
    <urls>
        <pair-key>/**/v1/**</pair-key>
        <pair-value>authcBearer, roles[admin]</pair-value>
    </urls>
    <urls>
        <pair-key>/**/config/aaa*/**</pair-key>
        <pair-value>authcBearer, roles[admin]</pair-value>
    </urls>
     <urls>
        <pair-key>/oauth/**</pair-key>
        <pair-value>anon</pair-value>
    </urls>
    <urls>
        <pair-key>/odlux/**</pair-key>
        <pair-value>anon</pair-value>
    </urls>
    <urls>
        <pair-key>/apidoc/**</pair-key>
        <pair-value>authcBasic</pair-value>
    </urls>
    <urls>
        <pair-key>/rests/**</pair-key>
        <pair-value>authcBearer, anyroles["admin,provision"]</pair-value>
    </urls>
    <urls>
        <pair-key>/**</pair-key>
        <pair-value>authcBearer, anyroles["admin,provision"]</pair-value>
    </urls>
</shiro-configuration>

Reply via email to