diff --git a/samples/pom.xml b/samples/pom.xml index 4090905ff5..0dcababe52 100644 --- a/samples/pom.xml +++ b/samples/pom.xml @@ -40,7 +40,6 @@ aspectj quickstart web - spring-client spring spring-mvc spring-hibernate diff --git a/samples/spring-client/pom.xml b/samples/spring-client/pom.xml deleted file mode 100644 index 517be6db71..0000000000 --- a/samples/spring-client/pom.xml +++ /dev/null @@ -1,153 +0,0 @@ - - - - - - - org.apache.shiro.samples - shiro-samples - 1.5.0-SNAPSHOT - ../pom.xml - - - 4.0.0 - samples-spring-client - Apache Shiro :: Samples :: Spring Client - A webstart application used to demonstrate Apache Shiro session and security management. - jar - - - ${sessionId} - 1.5 - - - - - log4j - log4j - runtime - - - org.apache.shiro - shiro-core - - - commons-beanutils - commons-beanutils - - - - - org.apache.shiro - shiro-spring - - - org.apache.shiro - shiro-web - - - org.springframework - spring-context - - - org.springframework - spring-webmvc - - - org.slf4j - slf4j-api - - - org.slf4j - slf4j-log4j12 - runtime - - - org.slf4j - jcl-over-slf4j - runtime - - - - - - - org.codehaus.mojo - webstart-maven-plugin - 1.0-beta-7 - - - package - - jnlp-inline - - - - - - - - - - shiro.jnlp.jsp - - org.apache.shiro.samples.spring.ui.WebStartDriver - - - - ${project.build.directory}/jnlp/jsecurity-sample.jks - jsecurity - jsecurity - false - - - - false - - false - - - - - org.codehaus.mojo - keytool-api - ${keytoolVersion} - - - org.codehaus.mojo - keytool-api-1.5 - ${keytoolVersion} - - - org.codehaus.mojo - keytool-api-1.6 - ${keytoolVersion} - - - org.codehaus.mojo - keytool-api-1.7 - ${keytoolVersion} - - - - - - - diff --git a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/SampleManager.java b/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/SampleManager.java deleted file mode 100644 index 3919b5456f..0000000000 --- a/samples/spring-client/src/main/java/org/apache/shiro/samples/spring/SampleManager.java +++ /dev/null @@ -1,64 +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; - -import org.apache.shiro.authz.annotation.RequiresPermissions; -import org.apache.shiro.authz.annotation.RequiresRoles; - - -/** - * Business manager interface used for sample application. - * - * @since 0.1 - */ -public interface SampleManager { - - /** - * Returns the value stored in the user's session. - * - * @return the value. - */ - String getValue(); - - - /** - * Sets a value to be stored in the user's session. - * - * @param newValue the new value to store in the user's session. - */ - void setValue(String newValue); - - /** - * Method that requires role1 in order to be invoked. - */ - @RequiresRoles("role1") - void secureMethod1(); - - /** - * Method that requires role2 in order to be invoked. - */ - @RequiresRoles("role2") - void secureMethod2(); - - /** - * Method that requires permission1 in order to be invoked. - */ - @RequiresPermissions("permission2") - void secureMethod3(); -} 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 bfe257fbad..0000000000 --- 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 ff62fbf9b2..0000000000 --- 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 SampleManager - * 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 eb2ff9bf14..0000000000 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 fdda48e34f..0000000000 --- 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" %> - - - - $project.Name - $project.Organization.Name - - $project.Description - - - #if($offlineAllowed) - - #end - - - - #if($allPermissions) - - - - - #end - - - - $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) - - --%> - - - ${sessionId} - - \ 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 901d6ecc0d..0000000000 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 431acc8678..0000000000 --- a/samples/spring-client/src/main/resources/webstart.spring.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -