You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2020/01/12 19:37:06 UTC
[shiro] branch master updated: [SHIRO-734] Remove Spring-client
sample
This is an automated email from the ASF dual-hosted git repository.
fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/master by this push:
new 6eb7836 [SHIRO-734] Remove Spring-client sample
new 0b52b2d Merge pull request #192 from fpapon/SHIRO-734
6eb7836 is described below
commit 6eb7836d28a056f41e1756e36cf766c5ae097b72
Author: Francois Papon <fp...@apache.org>
AuthorDate: Fri Jan 10 18:04:28 2020 +0100
[SHIRO-734] Remove Spring-client sample
---
samples/pom.xml | 1 -
samples/spring-client/pom.xml | 153 --------------------
.../shiro/samples/spring/ui/WebStartDriver.java | 38 -----
.../shiro/samples/spring/ui/WebStartView.java | 158 ---------------------
.../src/main/jnlp/resources/jsecurity-sample.jks | Bin 1250 -> 0 bytes
samples/spring-client/src/main/jnlp/template.vm | 53 -------
samples/spring-client/src/main/resources/logo.png | Bin 10883 -> 0 bytes
.../src/main/resources/webstart.spring.xml | 49 -------
samples/spring-mvc/pom.xml | 38 -----
.../apache/shiro/samples/spring/SampleManager.java | 2 +-
.../main/webapp/WEB-INF/resources/sampleIndex.jsp | 8 --
11 files changed, 1 insertion(+), 499 deletions(-)
diff --git a/samples/pom.xml b/samples/pom.xml
index 4090905..0dcabab 100644
--- a/samples/pom.xml
+++ b/samples/pom.xml
@@ -40,7 +40,6 @@
<module>aspectj</module>
<module>quickstart</module>
<module>web</module>
- <module>spring-client</module>
<module>spring</module>
<module>spring-mvc</module>
<module>spring-hibernate</module>
diff --git a/samples/spring-client/pom.xml b/samples/spring-client/pom.xml
deleted file mode 100644
index 517be6d..0000000
--- a/samples/spring-client/pom.xml
+++ /dev/null
@@ -1,153 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-<!--suppress osmorcNonOsgiMavenDependency -->
-<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 https://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.shiro.samples</groupId>
- <artifactId>shiro-samples</artifactId>
- <version>1.5.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>samples-spring-client</artifactId>
- <name>Apache Shiro :: Samples :: Spring Client</name>
- <description>A webstart application used to demonstrate Apache Shiro session and security management.</description>
- <packaging>jar</packaging>
-
- <properties>
- <shiro.session.id>${sessionId}</shiro.session.id>
- <keytoolVersion>1.5</keytoolVersion>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-core</artifactId>
- <exclusions>
- <exclusion>
- <groupId>commons-beanutils</groupId>
- <artifactId>commons-beanutils</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-spring</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.shiro</groupId>
- <artifactId>shiro-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-webmvc</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <scope>runtime</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>webstart-maven-plugin</artifactId>
- <version>1.0-beta-7</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>jnlp-inline</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- JNLP generation -->
- <jnlp>
- <!-- default values -->
- <!--inputTemplateResourcePath>${project.basedir}</inputTemplateResourcePath-->
- <!--inputTemplate>src/main/jnlp/template.vm</inputTemplate--> <!-- relative to inputTemplateResourcePath -->
- <outputFile>shiro.jnlp.jsp</outputFile>
- <!-- defaults to launch.jnlp -->
- <mainClass>org.apache.shiro.samples.spring.ui.WebStartDriver</mainClass>
- </jnlp>
-
- <sign>
- <keystore>${project.build.directory}/jnlp/jsecurity-sample.jks</keystore>
- <storepass>jsecurity</storepass>
- <alias>jsecurity</alias>
- <verify>false</verify>
- </sign>
- <!-- BUILDING PROCESS -->
- <pack200>
- <enabled>false</enabled>
- </pack200>
- <verbose>false</verbose>
-
- </configuration>
- <dependencies>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>keytool-api</artifactId>
- <version>${keytoolVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>keytool-api-1.5</artifactId>
- <version>${keytoolVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>keytool-api-1.6</artifactId>
- <version>${keytoolVersion}</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>keytool-api-1.7</artifactId>
- <version>${keytoolVersion}</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/WebStartDriver.java b/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/WebStartDriver.java
deleted file mode 100644
index bfe257f..0000000
--- a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/WebStartDriver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-package org.apache.shiro.samples.spring.ui;
-
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-/**
- * Driver class used to launch the web start application by loading a
- * Spring application context. Once the Spring application context is
- * loaded, the initialization of the {@link WebStartView} does the rest.
- *
- * @since 0.1
- */
-public class WebStartDriver {
- public static String LAUNCH_SESSION_ID;
-
- public static void main(String[] args) {
- // Store the session id given as argument to a static property to make it available for Spring context
- if (args.length > 0) LAUNCH_SESSION_ID = args[0];
- new ClassPathXmlApplicationContext("webstart.spring.xml");
- }
-}
diff --git a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/WebStartView.java b/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/WebStartView.java
deleted file mode 100644
index ff62fbf..0000000
--- a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/ui/WebStartView.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-package org.apache.shiro.samples.spring.ui;
-
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-import javax.swing.*;
-
-import org.springframework.beans.factory.InitializingBean;
-import org.springframework.core.io.ClassPathResource;
-
-import org.apache.shiro.authz.AuthorizationException;
-import org.apache.shiro.samples.spring.SampleManager;
-
-
-/**
- * Simple web start application that helps to demo single sign-on and
- * remoting authorization using Shiro. The injected <tt>SampleManager</tt>
- * is hosted by the Spring sample web application and remotely invoked
- * when the buttons in this view are clicked.
- *
- * @since 0.1
- */
-public class WebStartView implements ActionListener, InitializingBean {
-
- /*--------------------------------------------
- | C O N S T A N T S |
- ============================================*/
-
- /*--------------------------------------------
- | I N S T A N C E V A R I A B L E S |
- ============================================*/
- private SampleManager sampleManager;
- private JTextField valueField;
- private JButton saveButton;
- private JButton refreshButton;
- private JButton secureMethod1Button;
- private JButton secureMethod2Button;
- private JButton secureMethod3Button;
- private JFrame frame;
-
- /*--------------------------------------------
- | C O N S T R U C T O R S |
- ============================================*/
-
- /*--------------------------------------------
- | A C C E S S O R S / M O D I F I E R S |
- ============================================*/
-
- public void setSampleManager(SampleManager sampleManager) {
- this.sampleManager = sampleManager;
- }
-
- /*--------------------------------------------
- | M E T H O D S |
- ============================================*/
- public void afterPropertiesSet() throws Exception {
- ClassPathResource resource = new ClassPathResource("logo.png");
- ImageIcon icon = new ImageIcon(resource.getURL());
- JLabel logo = new JLabel(icon);
-
- valueField = new JTextField(20);
- updateValueLabel();
-
- saveButton = new JButton("Save Value");
- saveButton.addActionListener(this);
-
- refreshButton = new JButton("Refresh Value");
- refreshButton.addActionListener(this);
-
- JPanel valuePanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- valuePanel.add(valueField);
- valuePanel.add(saveButton);
- valuePanel.add(refreshButton);
-
- secureMethod1Button = new JButton("Method #1");
- secureMethod1Button.addActionListener(this);
-
- secureMethod2Button = new JButton("Method #2");
- secureMethod2Button.addActionListener(this);
-
- secureMethod3Button = new JButton("Method #3");
- secureMethod3Button.addActionListener(this);
-
- JPanel methodPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
- methodPanel.add(secureMethod1Button);
- methodPanel.add(secureMethod2Button);
- methodPanel.add(secureMethod3Button);
-
- frame = new JFrame("Apache Shiro Sample Application");
- frame.setSize(500, 200);
-
- Container panel = frame.getContentPane();
- panel.setLayout(new BorderLayout());
- panel.add(logo, BorderLayout.NORTH);
- panel.add(valuePanel, BorderLayout.CENTER);
- panel.add(methodPanel, BorderLayout.SOUTH);
-
- frame.setVisible(true);
- frame.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- });
- }
-
- private void updateValueLabel() {
- valueField.setText(sampleManager.getValue());
- }
-
- public void actionPerformed(ActionEvent e) {
- try {
-
- if (e.getSource() == saveButton) {
- sampleManager.setValue(valueField.getText());
-
- } else if (e.getSource() == refreshButton) {
- updateValueLabel();
-
- } else if (e.getSource() == secureMethod1Button) {
- sampleManager.secureMethod1();
- JOptionPane.showMessageDialog(frame, "Method #1 successfully called.", "Success", JOptionPane.INFORMATION_MESSAGE);
-
- } else if (e.getSource() == secureMethod2Button) {
- sampleManager.secureMethod2();
- JOptionPane.showMessageDialog(frame, "Method #2 successfully called.", "Success", JOptionPane.INFORMATION_MESSAGE);
- } else if (e.getSource() == secureMethod3Button) {
- sampleManager.secureMethod3();
- JOptionPane.showMessageDialog(frame, "Method #3 successfully called.", "Success", JOptionPane.INFORMATION_MESSAGE);
-
- } else {
- throw new RuntimeException("Unexpected action event from source: " + e.getSource());
- }
-
- } catch (AuthorizationException ae) {
- JOptionPane.showMessageDialog(frame, "Unauthorized to perform action: " + ae.getMessage(), "Unauthorized", JOptionPane.WARNING_MESSAGE);
- }
- }
-}
diff --git a/samples/spring-client/src/main/jnlp/resources/jsecurity-sample.jks b/samples/spring-client/src/main/jnlp/resources/jsecurity-sample.jks
deleted file mode 100644
index eb2ff9b..0000000
Binary files a/samples/spring-client/src/main/jnlp/resources/jsecurity-sample.jks and /dev/null differ
diff --git a/samples/spring-client/src/main/jnlp/template.vm b/samples/spring-client/src/main/jnlp/template.vm
deleted file mode 100644
index fdda48e..0000000
--- a/samples/spring-client/src/main/jnlp/template.vm
+++ /dev/null
@@ -1,53 +0,0 @@
-<%--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- --%>
-<%@ page contentType="application/x-java-jnlp-file" %>
-
-<jnlp spec="$jnlpspec" codebase="${codebaseUrl}">
- <information>
- <title>$project.Name</title>
- <vendor>$project.Organization.Name</vendor>
- <homepage href="$project.Url"/>
- <description>$project.Description</description>
- <icon kind="splash" href="logo.png"/>
-
- #if($offlineAllowed)
- <offline-allowed/>
- #end
-
- </information>
-
- #if($allPermissions)
-
- <security>
- <all-permissions/>
- </security>
- #end
-
- <resources>
- <j2se version="$j2seVersion"/>
- $dependencies
- <%-- reading custom system properties requires more permissions than available in sandbox mode,
- thus we need to sign the jars (although we are using an argument instead of a property to set this)
- <property name="shiro.session.id" value="${sessionId}"/>
- --%>
- </resources>
- <application-desc main-class="$mainClass">
- <argument>${sessionId}</argument>
- </application-desc>
-</jnlp>
\ No newline at end of file
diff --git a/samples/spring-client/src/main/resources/logo.png b/samples/spring-client/src/main/resources/logo.png
deleted file mode 100644
index 901d6ec..0000000
Binary files a/samples/spring-client/src/main/resources/logo.png and /dev/null differ
diff --git a/samples/spring-client/src/main/resources/webstart.spring.xml b/samples/spring-client/src/main/resources/webstart.spring.xml
deleted file mode 100644
index 431acc8..0000000
--- a/samples/spring-client/src/main/resources/webstart.spring.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one
- ~ or more contributor license agreements. See the NOTICE file
- ~ distributed with this work for additional information
- ~ regarding copyright ownership. The ASF licenses this file
- ~ to you 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.
- -->
-<!--
- - Application context for Shiro WebStart sample application
- -->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
-http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
-
- <bean id="webStartView"
- class="org.apache.shiro.samples.spring.ui.WebStartView">
- <property name="sampleManager" ref="sampleManager"/>
- </bean>
-
- <bean id="sampleManager"
- class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
- <property name="serviceUrl" value="http://localhost:8080/shiro-samples-spring/remoting/sampleManager"/>
- <property name="serviceInterface" value="org.apache.shiro.samples.spring.SampleManager"/>
- <property name="remoteInvocationFactory" ref="secureRemoteInvocationFactory"/>
- </bean>
-
- <bean id="secureRemoteInvocationFactory"
- class="org.apache.shiro.spring.remoting.SecureRemoteInvocationFactory">
- <constructor-arg index="0">
- <util:constant static-field="org.apache.shiro.samples.spring.ui.WebStartDriver.LAUNCH_SESSION_ID"/>
- </constructor-arg>
- </bean>
-
-</beans>
diff --git a/samples/spring-mvc/pom.xml b/samples/spring-mvc/pom.xml
index fe48a4b..2740c91 100644
--- a/samples/spring-mvc/pom.xml
+++ b/samples/spring-mvc/pom.xml
@@ -52,49 +52,11 @@
</webApp>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <phase>generate-resources</phase>
- <goals>
- <goal>unpack</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>org.apache.shiro.samples</groupId>
- <artifactId>samples-spring-client</artifactId>
- <version>${project.version}</version>
- <type>zip</type>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.directory}/extra/WEB-INF/resources</outputDirectory>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <configuration>
- <webResources>
- <resource>
- <directory>${project.build.directory}/extra</directory>
- </resource>
- </webResources>
- </configuration>
- </plugin>
</plugins>
</build>
<dependencies>
<dependency>
- <groupId>org.apache.shiro.samples</groupId>
- <artifactId>samples-spring-client</artifactId>
- </dependency>
- <dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
</dependency>
diff --git a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/SampleManager.java b/samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/SampleManager.java
similarity index 99%
rename from samples/spring-client/src/main/java/org/apache/shiro/samples/spring/SampleManager.java
rename to samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/SampleManager.java
index 3919b54..cf2999c 100644
--- a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/SampleManager.java
+++ b/samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/SampleManager.java
@@ -61,4 +61,4 @@ public interface SampleManager {
*/
@RequiresPermissions("permission2")
void secureMethod3();
-}
+}
\ No newline at end of file
diff --git a/samples/spring-mvc/src/main/webapp/WEB-INF/resources/sampleIndex.jsp b/samples/spring-mvc/src/main/webapp/WEB-INF/resources/sampleIndex.jsp
index a748cfa..0541051 100644
--- a/samples/spring-mvc/src/main/webapp/WEB-INF/resources/sampleIndex.jsp
+++ b/samples/spring-mvc/src/main/webapp/WEB-INF/resources/sampleIndex.jsp
@@ -61,20 +61,12 @@
<shiro:lacksPermission name="permission2">You do not have permission 2.<br/></shiro:lacksPermission>
</p>
-
<form action="<c:url value="/s/index"/>" method="POST">
Enter value here to store in session: <input type="text" name="value" value="${value}" size="30"/>
<input type="submit" value="Save"/>
<button type="button" onclick="document.location.href='<c:url value="/s/index"/>';">Refresh</button>
</form>
-
- <p>
- Click <a href="<c:url value="/s/shiro.jnlp?sessionId=${subjectSession.id}"/>">here</a> to launch webstart
- application.
- </p>
-
-
<p>
Click <a href="<c:url value="/s/logout"/>">here</a> to logout.
</p>