Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osgi updates for Grouper 5 #211

Draft
wants to merge 7 commits into
base: GROUPER_5_BRANCH
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions grouper-misc/grouper-test-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright 2014 Internet2

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.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>edu.internet2.middleware.grouper</groupId>
<artifactId>grouper-parent</artifactId>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../../grouper-parent</relativePath>
</parent>

<name>Grouper Test plugin</name>
<description>A Grouper test plugin. This can also be used as a protype/sample for creating a plugin</description>
<artifactId>grouper-test-plugin</artifactId>
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>8.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<index>true</index>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Implementation-Vendor>${project.organization.name}</Implementation-Vendor>
<Implementation-Title>${project.artifactId}</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-URL>${project.url}</Implementation-URL>
<Build-Timestamp>${maven.build.timestamp}</Build-Timestamp>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}-bundle</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Activator>edu.internet2.middleware.grouper.plugin.test.TestPlugin</Bundle-Activator>
<Export-Package>edu.internet2.middleware.grouper.plugin.test.filter</Export-Package>
<Private-Package>edu.internet2.middleware.grouper.plugin.*</Private-Package>
<Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>false</Embed-Transitive>
<Import-Package>
!*
</Import-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<keystore>${project.basedir}/src/main/signing/signing.jks</keystore>
<alias>signing</alias>
<storepass>signing</storepass>
<keypass>signing</keypass>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package edu.internet2.middleware.grouper.plugin.test;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;

import javax.servlet.ServletContainerInitializer;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;

public class TestPlugin implements BundleActivator {
private Map<String, ServiceRegistration> registrationMap = new HashMap<>();

@Override
public void start(BundleContext bundleContext) throws Exception {
TestPluginServletContainerInitializer initializer = new TestPluginServletContainerInitializer();
ServiceRegistration registration = bundleContext.registerService(ServletContainerInitializer.class, initializer, new Hashtable<>());
registrationMap.put(TestPluginServletContainerInitializer.class.getCanonicalName(), registration);
}

@Override
public void stop(BundleContext bundleContext) throws Exception {
registrationMap.values().forEach(x -> { x.unregister(); } );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package edu.internet2.middleware.grouper.plugin.test;

import edu.internet2.middleware.grouper.plugin.test.filter.TestFilter;

import javax.servlet.FilterRegistration;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import java.util.Set;

public class TestPluginServletContainerInitializer implements ServletContainerInitializer {
@Override
public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
TestFilter testFilter = new TestFilter();
FilterRegistration.Dynamic testFilterRegistration = servletContext.addFilter("testFilter", testFilter);
testFilterRegistration.addMappingForUrlPatterns(null, false, "/*");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package edu.internet2.middleware.grouper.plugin.test.filter;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;

public class TestFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
filterChain.doFilter(servletRequest, servletResponse);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These files are strictly examples and for testing. Do not use them in your own projects!
21 changes: 21 additions & 0 deletions grouper-misc/grouper-test-plugin/src/main/signing/signing.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDczCCAlugAwIBAgIILehkAIY5xvQwDQYJKoZIhvcN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to8MCJUtg7d+Run+HvtgjNsdYLI6J+6K9+51STLtXST90V
voa3jXptx9Tl/BFoJK2sJWdoIwG3zug=
-----END CERTIFICATE-----
Binary file not shown.
Binary file not shown.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
<groupId>edu.internet2.middleware.grouper</groupId>
<artifactId>grouper-parent</artifactId>
<version>5.0.0-SNAPSHOT</version>
<relativePath>../../../grouper-parent</relativePath>
<relativePath>../../grouper-parent</relativePath>
</parent>
<name>Grouper UI webapp</name>
<artifactId>grouper-ui-webapp</artifactId>

<name>Grouper webapp</name>
<artifactId>grouper-webapp</artifactId>
<packaging>war</packaging>

<dependencies>
Expand All @@ -38,12 +38,17 @@
<artifactId>grouper-ui</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>grouper-ws</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>../../../grouper/conf</directory>
<directory>../../grouper/conf</directory>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take this out

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I remember why this is here, but need to verify: ddls for some reason were missing from the classpath

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DDLs should be packaged in the grouper jar now

</resource>
</resources>
<plugins>
Expand All @@ -55,19 +60,21 @@
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<resource>
<directory>../../../grouper-ui/webapp</directory>
<directory>../../grouper-ui/webapp</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.27.v20200227</version>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<version>1.10.9</version>
<configuration>
<webApp>
<contextPath>/grouper</contextPath>
</webApp>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
Expand All @@ -84,5 +91,33 @@
</resources>
</build>
</profile>
<profile>
<id>debug</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven3-plugin</artifactId>
<version>1.10.9</version>
<configuration>
<container>
<timeout>3600000</timeout>
</container>
<configuration>
<properties>
<cargo.servlet.port>8080</cargo.servlet.port>
<cargo.start.jvmargs>
-Xdebug
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
-Xnoagent
-Djava.compiler=NONE
</cargo.start.jvmargs>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
15 changes: 15 additions & 0 deletions grouper-misc/webapp/src/test/resources/grouper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
grouper.osgi.enable = true
grouper.osgi.security.enable=false

# directory of plugins, default to /opt/grouper/grouperWebapp/WEB-INF/grouperPlugins
# {valueType: "string", required: true, order: 1000}
grouper.osgi.jar.dir = /Users/jj/Documents/workspace/community/grouper-ext-auth/target

# directory of felix cache of plugins, default to /opt/grouper/grouperWebapp/WEB-INF/grouperFelixCache
# {valueType: "string", required: true, order: 2000}
grouper.felix.cache.rootdir = /tmp/grouperFelixCache

grouper.osgi.plugin.extauth.location=file:/Users/jj/Documents/workspace/community/grouper-ext-auth/target/grouper-authentication-plugin-0.0.1-SNAPSHOT.jar
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to change this to something more generic


# grouper.osgi.framework.system.packages.extra=javax.*,org.osgi.*,org.osgi,org.apache.commons.logging,edu.internet2.middleware.grouperClient.config,edu.internet2.middleware.grouper.app.externalSystem,org.w3c.dom.*
# grouper.osgi.framework.boot.delegation=javax.*,org.osgi.*,org.osgi,org.apache.commons.logging,edu.internet2.middleware.grouperClient.config,edu.internet2.middleware.grouper.app.externalSystem,org.w3c.dom.*
Loading