shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdem...@apache.org
Subject shiro git commit: Removing dead code from samples
Date Thu, 10 Nov 2016 20:10:56 GMT
Repository: shiro
Updated Branches:
  refs/heads/master 77c59622b -> 2606a3876


Removing dead code from samples


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/2606a387
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/2606a387
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/2606a387

Branch: refs/heads/master
Commit: 2606a3876de8b325be76f8735c743d593ef5eed7
Parents: 77c5962
Author: Brian Demers <bdemers@apache.org>
Authored: Thu Nov 10 15:08:41 2016 -0500
Committer: Brian Demers <bdemers@apache.org>
Committed: Thu Nov 10 15:08:41 2016 -0500

----------------------------------------------------------------------
 samples/standalone/src/main/java/MyRealm.java   | 78 --------------------
 .../standalone/src/main/java/Standalone.java    | 48 ------------
 .../src/main/resources/log4j.properties         | 37 ----------
 samples/standalone/src/main/resources/shiro.ini | 34 ---------
 4 files changed, 197 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/2606a387/samples/standalone/src/main/java/MyRealm.java
----------------------------------------------------------------------
diff --git a/samples/standalone/src/main/java/MyRealm.java b/samples/standalone/src/main/java/MyRealm.java
deleted file mode 100644
index 3a5f75e..0000000
--- a/samples/standalone/src/main/java/MyRealm.java
+++ /dev/null
@@ -1,78 +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.
- */
-
-import org.apache.shiro.authz.AuthorizationInfo;
-import org.apache.shiro.realm.AuthorizingRealm;
-import org.apache.shiro.subject.PrincipalCollection;
-
-/**
- */
-public class MyRealm extends AuthorizingRealm {
-
-    public MyRealm() {
-    }
-
-    /**
-     * Simulates a call to an underlying data store - in a 'real' application, this call
would communicate with
-     * an underlying data store via an EIS API (JDBC, JPA, Hibernate, etc).
-     * <p/>
-     * Note that when implementing your own realm, there is no need to check against a password
(or other credentials)
-     * in this method. The {@link org.apache.shiro.realm.AuthenticatingRealm AuthenticatingRealm}
superclass will do
-     * that automatically via the use of a configured
-     * {@link org.apache.shiro.authc.credential.CredentialsMatcher CredentialsMatcher} (see
this example's corresponding
-     * {@code shiro.ini} file to see a configured credentials matcher).
-     * <p/>
-     * All that is required is that the account information include directly the credentials
found in the EIS.
-     *
-     * @param username the username for the account data to retrieve
-     * @return the Account information corresponding to the specified username:
-     */
-    protected SimpleAccount getAccount(String username) {
-        //just create a dummy.  A real app would construct one based on EIS access.
-        SimpleAccount account = new SimpleAccount(username, "sha256EncodedPasswordFromDatabase",
getName());
-        //simulate some roles and permissions:
-        account.addRole("user");
-        account.addRole("admin");
-        //most applications would assign permissions to Roles instead of users directly because
this is much more
-        //flexible (it is easier to configure roles and then change role-to-user assignments
than it is to maintain
-        // permissions for each user).
-        // But these next lines assign permissions directly to this trivial account object
just for simulation's sake:
-        account.addStringPermission("blogEntry:edit"); //this user is allowed to 'edit' _any_
blogEntry
-        //fine-grained instance level permission:
-        account.addStringPermission("printer:print:laserjet2000"); //allowed to 'print' to
the 'printer' identified
-        //by the id 'laserjet2000'
-
-        return account;
-    }
-
-    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws
AuthenticationException {
-        //we can safely cast to a UsernamePasswordToken here, because this class 'supports'
UsernamePasswordToken
-        //objects.  See the Realm.supports() method if your application will use a different
type of token.
-        UsernamePasswordToken upToken = (UsernamePasswordToken) token;
-        return getAccount(upToken.getUsername());
-    }
-
-    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
-        //get the principal this realm cares about:
-        String username = (String) getAvailablePrincipal(principals);
-
-        //call the underlying EIS for the account data:
-        return getAccount(username);
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/2606a387/samples/standalone/src/main/java/Standalone.java
----------------------------------------------------------------------
diff --git a/samples/standalone/src/main/java/Standalone.java b/samples/standalone/src/main/java/Standalone.java
deleted file mode 100644
index 7f8994f..0000000
--- a/samples/standalone/src/main/java/Standalone.java
+++ /dev/null
@@ -1,48 +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.
- */
-
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.config.IniConfiguration;
-import org.apache.shiro.subject.Subject;
-
-/**
- * @since Aug 28, 2008 5:46:16 PM
- */
-public class Standalone {
-
-    public static void main(String[] args) {
-
-        IniConfiguration config = new IniConfiguration();
-        //the following call will automatically use shiro.ini at the root of the classpath:
-        config.init();
-
-        //This is for Standalone (single-VM) applications that don't use a configuration
container (Spring, JBoss, etc)
-        //See its JavaDoc for our feelings on this.
-        SecurityUtils.setSecurityManager(config.getSecurityManager());
-
-        //Now you are ready to access the Subject, as shown in the Quickstart:
-        Subject currentUser = SecurityUtils.getSubject();
-
-        //anything else you want to do with the Subject (see the Quickstart for examples).
-
-        currentUser.logout();
-
-        System.exit(0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/2606a387/samples/standalone/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/samples/standalone/src/main/resources/log4j.properties b/samples/standalone/src/main/resources/log4j.properties
deleted file mode 100644
index ef36028..0000000
--- a/samples/standalone/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,37 +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.
-#
-log4j.rootLogger=INFO, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - %m %n
-
-# General Apache libraries
-log4j.logger.org.apache=WARN
-
-# Spring
-log4j.logger.org.springframework=WARN
-
-# Default Shiro logging
-log4j.logger.org.apache.shiro=TRACE
-
-# Disable verbose logging
-log4j.logger.org.apache.shiro.util.ThreadContext=WARN
-log4j.logger.org.apache.shiro.cache.ehcache.EhCache=WARN
-

http://git-wip-us.apache.org/repos/asf/shiro/blob/2606a387/samples/standalone/src/main/resources/shiro.ini
----------------------------------------------------------------------
diff --git a/samples/standalone/src/main/resources/shiro.ini b/samples/standalone/src/main/resources/shiro.ini
deleted file mode 100644
index cdbfe4e..0000000
--- a/samples/standalone/src/main/resources/shiro.ini
+++ /dev/null
@@ -1,34 +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.
-#
-[main]
-# Any realms here will automatically be added to the default created securityManager.  No
need to define
-# a securityManager here unless you want to override the default. If you want to override
the default, you would
-# do it by uncommenting this line and specifying the fully qualified class name of your SecurityManager
implementation:
-# securityManager = my.domain.package.MySecurityManager
-
-# define the realm(s) we want to use for our application.  If you have more than one realm,
the order in which they
-# are defined is the order in which they will be consulted during the authentication process.
-# This simple example uses only a single realm, but you could add more for more complicated
requirements.
-
-# We'll use credentials hashing, since that keeps the users' credentials (passwords, private
keys, etc) safe:
-myRealmCredentialsMatcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
-
-# now define the realm, and specify that it use the above credentials matcher:
-myRealm = MyRealm
-myRealm.credentialsMatcher = $myRealmCredentialsMatcher
\ No newline at end of file


Mime
View raw message