kandi background
Explore Kits

shiro-redis | shiro only provide the support of ehcache | Security Framework library

 by   alexxiyang Java Version: 3.3.0 License: MIT

 by   alexxiyang Java Version: 3.3.0 License: MIT

Download this library from

kandi X-RAY | shiro-redis Summary

shiro-redis is a Java library typically used in Security, Security Framework, Spring applications. shiro-redis has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.
shiro only provide the support of ehcache and concurrentHashMap. Here is an implement of redis cache can be used by shiro. Hope it will help you!
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • shiro-redis has a medium active ecosystem.
  • It has 1017 star(s) with 419 fork(s). There are 78 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 16 open issues and 104 have been closed. On average issues are closed in 231 days. There are 1 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of shiro-redis is 3.3.0
shiro-redis Support
Best in #Security Framework
Average in #Security Framework
shiro-redis Support
Best in #Security Framework
Average in #Security Framework

quality kandi Quality

  • shiro-redis has 0 bugs and 0 code smells.
shiro-redis Quality
Best in #Security Framework
Average in #Security Framework
shiro-redis Quality
Best in #Security Framework
Average in #Security Framework

securitySecurity

  • shiro-redis has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • shiro-redis code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
shiro-redis Security
Best in #Security Framework
Average in #Security Framework
shiro-redis Security
Best in #Security Framework
Average in #Security Framework

license License

  • shiro-redis is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
shiro-redis License
Best in #Security Framework
Average in #Security Framework
shiro-redis License
Best in #Security Framework
Average in #Security Framework

buildReuse

  • shiro-redis releases are available to install and integrate.
  • Deployable package is available in Maven.
  • Build file is available. You can build the component from source.
  • shiro-redis saves you 1073 person hours of effort in developing the same functionality from scratch.
  • It has 2430 lines of code, 290 functions and 30 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
shiro-redis Reuse
Best in #Security Framework
Average in #Security Framework
shiro-redis Reuse
Best in #Security Framework
Average in #Security Framework
Top functions reviewed by kandi - BETA

kandi has reviewed shiro-redis and discovered the below as its top functions. This is intended to give you an instant insight into shiro-redis implemented functionality, and help decide if they suit your requirements.

  • get all values
  • read a session from Redis
  • Apply the class loader to the class loader
  • Returns the number of elements in the redis db .
  • Serializes an object into a byte array .
  • Get the keys from the cluster .
  • Get a cache by name
  • Deserializes a byte array into a String .
  • Get an instance of the jedis .
  • Set the master name

shiro-redis Key Features

shiro only provide the support of ehcache and concurrentHashMap. Here is an implement of redis cache can be used by shiro. Hope it will help you!

Community Discussions

Trending Discussions on shiro-redis
  • when called Securityutils.getsubject().hasRole("any") with multipe realms, for a nonexistent role throws an exception
Trending Discussions on shiro-redis

QUESTION

when called Securityutils.getsubject().hasRole("any") with multipe realms, for a nonexistent role throws an exception

Asked 2020-May-20 at 18:59

I created two realms for authentication in apache shiro, but when i tried to call hasRole("any") it throws the following exception (if the role exists, it returns true):

java.lang.ClassCastException: org.apache.shiro.subject.SimplePrincipalCollection cannot be cast to java.lang.String
    at com.ws.shiro.RedisStringSerializer.serialize(RedisStringSerializer.java:13) ~[shiro-redis-3.0.2.jar:?]
    at org.crazycake.shiro.RedisCache.get(RedisCache.java:79) ~[shiro-redis-3.2.2.jar:?]
    at org.apache.shiro.realm.AuthorizingRealm.getAuthorizationInfo(AuthorizingRealm.java:328) ~[shiro-core-1.3.2.jar:1.3.2]
    at org.apache.shiro.realm.AuthorizingRealm.hasRole(AuthorizingRealm.java:573) ~[shiro-core-1.3.2.jar:1.3.2]
    at org.apache.shiro.authz.ModularRealmAuthorizer.hasRole(ModularRealmAuthorizer.java:374) ~[shiro-core-1.3.2.jar:1.3.2]
    at org.apache.shiro.mgt.AuthorizingSecurityManager.hasRole(AuthorizingSecurityManager.java:153) ~[shiro-core-1.3.2.jar:1.3.2]
    at org.apache.shiro.subject.support.DelegatingSubject.hasRole(DelegatingSubject.java:224) ~[shiro-core-1.3.2.jar:1.3.2]
    at com.ws.user.login.LoginResource.login(LoginResource.java:65) ~[main/:?]

the SHIRO.INI is:

# =======================
# Shiro INI configuration
# =======================


## Using Sha256 cryptography
credentialsMatcher = org.apache.shiro.authc.credential.HashedCredentialsMatcher
credentialsMatcher.hashAlgorithmName=SHA-256
credentialsMatcher.hashIterations = 1024
credentialsMatcher.storedCredentialsHexEncoded = false
dbRealm = com.ws.user.realm.DataBaseRealm
dbRealm.credentialsMatcher = $credentialsMatcher

credentialsMatcherToken = com.ws.user.realm.CustomCredentialMatcherToken
credentialsMatcherToken.hashAlgorithmName=SHA-256
credentialsMatcherToken.hashIterations = 1024
credentialsMatcherToken.storedCredentialsHexEncoded = false

tokenRealm = com.ws.user.realm.DataBaseBearerRealm
tokenRealm.credentialsMatcher = $credentialsMatcherToken

securityManager.realms = $dbRealm, $tokenRealm

#redisManager
redisManager = com.ws.shiro.RedisManager
redisManager.host = <THERE IS A HOST HERE>
redisManager.port = 6379
redisManager.expire = 1000
redisManager.timeout = 0

#============redisSessionDAO=============
redisSessionDAO = com.ws.shiro.RedisSessionDAO
redisSessionDAO.redisManager = $redisManager
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionDAO = $redisSessionDAO
securityManager.sessionManager = $sessionManager

#============redisCacheManager===========
cacheManager = com.ws.shiro.RedisCacheManager
cacheManager.redisManager = $redisManager
securityManager.cacheManager = $cacheManager

It seems to be some config, cause when debugging, it goes just for the actual token that I tried to authenticate, but in the class ModularRealmAuthorizer, method hasRole, it was called twice, one each realm, the first was ok, and then in the second Realm, it throws the exception.

ANSWER

Answered 2020-May-20 at 13:36

Problem solved! I forgot to override the method getAuthorizationCacheKey, in one of my custom realm.

Source https://stackoverflow.com/questions/61913681

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install shiro-redis

You can download it from GitHub, Maven.
You can use shiro-redis like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the shiro-redis component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

Support

For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Security Framework Libraries
Compare Security Framework Libraries with Highest Support
Compare Security Framework Libraries with Highest Quality
Compare Security Framework Libraries with Permissive License
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.