</dependencyManagement>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.aaa</groupId>
+ <artifactId>features-aaa-shiro</artifactId>
+ <version>${aaa.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>features-protocol-framework</artifactId>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcpkix-jdk15on</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.bouncycastle</groupId>
+ <artifactId>bcprov-jdk15on</artifactId>
+ </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>netconf-client</artifactId>
<feature version='${project.version}'>odl-netconf-mapping-api</feature>
<feature version='${project.version}'>odl-netconf-util</feature>
<bundle>mvn:org.opendaylight.netconf/netconf-netty-util/{{VERSION}}</bundle>
- <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
- <bundle>mvn:org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}</bundle>
+ <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/{{VERSION}}</bundle>
+ <bundle>mvn:org.bouncycastle/bcprov-jdk15on/{{VERSION}}</bundle>
<bundle>mvn:org.apache.sshd/sshd-core/{{VERSION}}</bundle>
<bundle>mvn:openexi/nagasena/{{VERSION}}</bundle>
<bundle>mvn:io.netty/netty-codec/{{VERSION}}</bundle>
<controller.mdsal.version>1.3.0-SNAPSHOT</controller.mdsal.version>
<features.test.version>1.6.0-SNAPSHOT</features.test.version>
<jersey-servlet.version>1.17</jersey-servlet.version>
-
<mdsal.version>2.0.0-SNAPSHOT</mdsal.version>
<mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.version>
<restconf.version>1.3.0-SNAPSHOT</restconf.version>
- <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
<surefire.version>2.15</surefire.version>
+ <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
<features.file>features.xml</features.file>
<config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
</dependency>
<dependency>
<groupId>org.opendaylight.aaa</groupId>
- <artifactId>features-aaa</artifactId>
+ <artifactId>features-aaa-shiro</artifactId>
<version>${aaa.version}</version>
<classifier>features</classifier>
<type>xml</type>
</dependency>
-
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-remote</artifactId>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
- <version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
- <version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
- <version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<repository>mvn:org.opendaylight.controller/features-mdsal/{{VERSION}}/xml/features</repository>
<repository>mvn:org.opendaylight.yangtools/features-yangtools/{{VERSION}}/xml/features</repository>
- <repository>mvn:org.opendaylight.aaa/features-aaa/{{VERSION}}/xml/features</repository>
+ <repository>mvn:org.opendaylight.aaa/features-aaa-shiro/{{VERSION}}/xml/features</repository>
<feature name='odl-restconf-all' version='${project.version}' description='OpenDaylight :: Restconf :: All'>
<feature version='${project.version}'>odl-restconf</feature>
<feature version='${project.version}'>odl-mdsal-apidocs</feature>
</feature>
<feature name='odl-restconf' version='${project.version}' description="OpenDaylight :: Restconf">
- <feature version='${aaa.version}'>odl-aaa-authn</feature>
+ <!-- Enables AAA through the odl-shiro-act bundle Activator -->
+ <bundle>mvn:org.opendaylight.aaa/aaa-shiro-act/{{VERSION}}</bundle>
<feature version='${project.version}'>odl-restconf-noauth</feature>
</feature>
<feature name='odl-restconf-noauth' version='${project.version}' description="OpenDaylight :: Restconf">
+ <feature version='${aaa.version}'>odl-aaa-shiro</feature>
<feature version='${controller.mdsal.version}'>odl-mdsal-broker</feature>
<feature>war</feature>
<!-- presently we need sal-remote to be listed BEFORE sal-rest-connector because sal-rest-connector
of the session that made the change will be reported.";
choice server-or-user {
mandatory true;
- //FIXME: After Bug 4414 is resolved, use shorthand version of case statement
- case server {
- leaf server {
- type empty;
- description
+ leaf server {
+ type empty;
+ description
"If present, the change was caused
- by the server.";
- }
+ by the server.";
}
+
case by-user {
uses common-session-parms;
}
Preconditions.checkArgument(editContent.exists(), "Edit content file missing");
Preconditions.checkArgument(editContent.isDirectory() == false, "Edit content file is a dir");
Preconditions.checkArgument(editContent.canRead(), "Edit content file is unreadable");
+
+ Preconditions.checkArgument(destination.startsWith("/"), "Destination should start with a '/'");
+
// TODO validate
}
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-remote</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-api</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-data-impl</artifactId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>com.sun.jersey</groupId>
+ <artifactId>jersey-server</artifactId>
+ </dependency>
<!-- Testing Dependencies -->
<dependency>
<build>
<plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <classpathDependencyExcludes>
+ <!-- Removes com.sun.jersey from testing classpath so there is no conflict with org.glassfish.jersey -->
+ <classpathDependencyExclude>com.sun.jersey</classpathDependencyExclude>
+ </classpathDependencyExcludes>
+ </configuration>
+ </plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.rest.connector.rev140724.*,
</Private-Package>
<Import-Package>
- com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets,
- <!-- Set the javax packages version to 0. Relying on "*" includes versions from jsr305 dependency whic are
- incompatible with karaf provided packages -->
- javax.*;version="0.0",
*,
+ com.sun.jersey.spi.container.servlet,
+ org.eclipse.jetty.servlets,
+ org.opendaylight.aaa.shiro.filters,
+ org.opendaylight.aaa.shiro.realm,
+ org.opendaylight.aaa.shiro.web.env,
+ org.apache.shiro.web.env
</Import-Package>
<Embed-Dependency>stax-utils</Embed-Dependency>
<Web-ContextPath>/restconf</Web-ContextPath>
import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.ForwardingNormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
// stream writer validates the node type against the schema and thus will expect a LeafSchemaNode but
// the schema has a ContainerSchemaNode so, to avoid an error, we override the leafNode behavior
// for error-info.
- final NormalizedNodeStreamWriter streamWriter = new DelegatingNormalizedNodeStreamWriter(jsonStreamWriter) {
+ final NormalizedNodeStreamWriter streamWriter = new ForwardingNormalizedNodeStreamWriter() {
+ @Override
+ protected NormalizedNodeStreamWriter delegate() {
+ return jsonStreamWriter;
+ }
+
@Override
public void leafNode(final NodeIdentifier name, final Object value) throws IOException {
if(name.getNodeType().equals(Draft02.RestConfModule.ERROR_INFO_QNAME)) {
// stream writer validates the node type against the schema and thus will expect a LeafSchemaNode but
// the schema has a ContainerSchemaNode so, to avoid an error, we override the leafNode behavior
// for error-info.
- final NormalizedNodeStreamWriter streamWriter = new DelegatingNormalizedNodeStreamWriter(xmlStreamWriter) {
+ final NormalizedNodeStreamWriter streamWriter = new ForwardingNormalizedNodeStreamWriter() {
+ @Override
+ protected NormalizedNodeStreamWriter delegate() {
+ return xmlStreamWriter;
+ }
+
@Override
public void leafNode(final NodeIdentifier name, final Object value) throws IOException {
if(name.getNodeType().equals(Draft02.RestConfModule.ERROR_INFO_QNAME)) {
nnWriter.flush();
}
}
-
- private static class DelegatingNormalizedNodeStreamWriter implements NormalizedNodeStreamWriter {
- private final NormalizedNodeStreamWriter delegate;
-
- DelegatingNormalizedNodeStreamWriter(NormalizedNodeStreamWriter delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public void leafNode(NodeIdentifier name, Object value) throws IOException, IllegalArgumentException {
- delegate.leafNode(name, value);
- }
-
- @Override
- public void startLeafSet(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- delegate.startLeafSet(name, childSizeHint);
- }
-
- @Override
- public void leafSetEntryNode(Object value) throws IOException, IllegalArgumentException {
- delegate.leafSetEntryNode(value);
- }
-
- @Override
- public void startContainerNode(NodeIdentifier name, int childSizeHint) throws IOException,
- IllegalArgumentException {
- delegate.startContainerNode(name, childSizeHint);
- }
-
- @Override
- public void startUnkeyedList(NodeIdentifier name, int childSizeHint) throws IOException,
- IllegalArgumentException {
- delegate.startUnkeyedList(name, childSizeHint);
- }
-
- @Override
- public void startUnkeyedListItem(NodeIdentifier name, int childSizeHint) throws IOException,
- IllegalStateException {
- delegate.startUnkeyedListItem(name, childSizeHint);
- }
-
- @Override
- public void startMapNode(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
- delegate.startMapNode(name, childSizeHint);
- }
-
- @Override
- public void startMapEntryNode(NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException,
- IllegalArgumentException {
- delegate.startMapEntryNode(identifier, childSizeHint);
- }
-
- @Override
- public void startOrderedMapNode(NodeIdentifier name, int childSizeHint) throws IOException,
- IllegalArgumentException {
- delegate.startOrderedMapNode(name, childSizeHint);
- }
-
- @Override
- public void startChoiceNode(NodeIdentifier name, int childSizeHint) throws IOException,
- IllegalArgumentException {
- delegate.startChoiceNode(name, childSizeHint);
- }
-
- @Override
- public void startAugmentationNode(AugmentationIdentifier identifier) throws IOException,
- IllegalArgumentException {
- delegate.startAugmentationNode(identifier);
- }
-
- @Override
- public void anyxmlNode(NodeIdentifier name, Object value) throws IOException, IllegalArgumentException {
- delegate.anyxmlNode(name, value);
- }
-
- @Override
- public void startYangModeledAnyXmlNode(NodeIdentifier name, int childSizeHint) throws IOException {
- delegate.startYangModeledAnyXmlNode(name, childSizeHint);
- }
-
- @Override
- public void endNode() throws IOException, IllegalStateException {
- delegate.endNode();
- }
-
- @Override
- public void close() throws IOException {
- delegate.close();
- }
-
- @Override
- public void flush() throws IOException {
- delegate.flush();
- }
- }
}
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.opendaylight.netconf.sal.rest.impl.RestconfApplication</param-value>
</init-param>
- <!-- AAA Auth Filter -->
- <init-param>
- <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
- <param-value> org.opendaylight.aaa.sts.TokenAuthFilter</param-value>
- </init-param>
<load-on-startup>1</load-on-startup>
</servlet>
+ <context-param>
+ <param-name>shiroEnvironmentClass</param-name>
+ <param-value>org.opendaylight.aaa.shiro.web.env.KarafIniWebEnvironment</param-value>
+ </context-param>
+
+ <listener>
+ <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
+ </listener>
+
+ <filter>
+ <filter-name>ShiroFilter</filter-name>
+ <filter-class>org.opendaylight.aaa.shiro.filters.AAAFilter</filter-class>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>ShiroFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
<servlet-mapping>
<servlet-name>JAXRSRestconf</servlet-name>
<url-pattern>/*</url-pattern>