Re: Shiro with Weblogic User/Password

2019-10-29 Thread scSynergy
You have to write a class which implements org.apache.shiro.realm.Realm or extends one of the existing Realms in that package and add it to your Shiro configuration. Inside your custom Realm you would have to lookup user credentials stored in your Weblogic server and create an AuthenticationToken

CDI support - will it ever arrive?

2019-10-10 Thread scSynergy
Years ago plans were announced to add CDI support into Shiro. Now, I wonder what happened to that plan? After all, Harald Wellmann generously provided his PAX Shiro implementation to the community - so what is keeping it from getting integrated? https://issues.apache.org/jira/browse/SHIRO-337

Re: Multiple Realms for Authentication & Authorization

2018-12-13 Thread scSynergy
I believe it to be OK if you include the fix in the 1.4 version even if it breaks some existing applications. After all, the 1.4 release is a major upgrade - so changes in behavior are to be expected. -- Sent from: http://shiro-user.582556.n2.nabble.com/

Re: Multiple Realms for Authentication & Authorization

2018-12-10 Thread scSynergy
@Brian: Is this behavior of FirstSuccessfulStrategy by design or is it a bug? To me it seems wrong that authorization is checked against a realm which was not authenticated against - after all, that second authentication might fail, if it were to be tried. -- Sent from:

Re: How to integrate shiro with redis for session manager using spring boot?

2017-09-18 Thread scSynergy
You have to implement your own CacheManager and Cache and configure Shiro to use them. These are my classes for Infinispan; you can use them as examples for your Redis implementation: shiro.ini [main] ... securityManager.cacheManager = $cacheManagerInfinispan ...

Re: EnvironmentLoadListener initialzation from EJB

2017-03-08 Thread scSynergy
This is what we use in a bean annotated with @Startup @Singleton: @PostConstruct public void initializeShiro() { String iniFile = retrieveFromDatabase(); // real implementation omitted for clarity Ini ini = new Ini(); ini.load(iniFile); String

Re: bug report

2017-01-19 Thread scSynergy
One other possibility, though far from perfect, is to have shiroFilter.setFilterChainDefinitionMap(definitionsMap) only accept LinkedHashMap or TreeMap as parameters instead of accepting just any Map. I think those are the only Map implementations in standard Java SE which retain order. -- View

Re: A ponion about org.apache.shiro.authc.AbstractAuthenticator.authenticate(AuthenticationToken token)

2016-12-16 Thread scSynergy
I believe the only way to achieve the desired behavior is to make 'log spam' the default behavior and allow us to override it via an option in Shiro's configuration, instead of hard coding log levels. Brian Demers wrote > There have been a couple issues on either side of this. > > These

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-11-18 Thread scSynergy
Sorry, I have no idea where the 302 might originate from. You would use the web form for the web client and BasicAuth for the requests from the desktop client to the REST services since the desktop client is probably not designed to handle web pages (string parsing is just sooo awful). If you

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-11-16 Thread scSynergy
If you cannot log in then something is wrong - did an exception get thrown or some other hint show up as to what might be the cause? A failed login attempt should return an HTTP 401 response so as to behave in a way that most people would expect - but there is no technical reason for it. Basic

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-10-31 Thread scSynergy
If you configure the FormAuthenticationFilter to protect every HTTP request in the [urls] section (/** = authc) then users would not be able to access your login page without being authenticated. So, in order to let users access the login page you specify it in the ini file which causes Shiro to

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-10-27 Thread scSynergy
I think I do not understand your questions - if Shiro has been already initialized on the server for the web application, then, why do it a second time? What do you mean with 'work with / access the ini file"? What do you mean by "access the FormAuthenticationFilter"? You do not need to access it,

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-10-27 Thread scSynergy
The Shiro environment is only initialized on the server - *not* on the clients. The clients need not know Shiro even exists, since they only use regular HTTP requests with either Basic Authentication (desktop client [REST]) or Form Authentication (Browser [HTTP session]). The server is initialized

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-10-14 Thread scSynergy
The subject is a kind of proxy to the underlying SecurityManager meaning some methods of Subject actually just trigger calls to the SecurityManager which in turn triggers methods on the configured realms. You would use subject.isAuthenticated() on the server's HTTP interface to determine whether

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-10-14 Thread scSynergy
I believe JSPs offer no benefit - they have been replaced by JSF within JEE. You can use servlets without JSP or JSF, but if you do use JSP or JSF you will need an application server like Wildfly or Glassfish or have to include the required components into Tomcat yourselves. You do not check

Re: How should we go about configuring a Desktop Client with Shiro in the Server?

2016-10-12 Thread scSynergy
All browsers handle sessions for you, so on the web client you need *not* check sessions but instead just do form authentication: https://shiro.apache.org/webapp-tutorial.html#step3 (you need not use a JSP page, any POST operation that results in the same HTTP request will work) And then the

Re: New Committer: Andreas Kohn

2016-07-20 Thread scSynergy
Welcome Andreas, glad to have you on board! -- View this message in context: http://shiro-user.582556.n2.nabble.com/New-Committer-Andreas-Kohn-tp7581150p7581154.html Sent from the Shiro User mailing list archive at Nabble.com.

Re: Row-level Access Control Tips

2016-07-14 Thread scSynergy
I love Shiro. That being said I believe it is ill suited to situations like the one you describe. We sell a ECM / DMS product where customers may store millions of documents. If we were to store every document's permissions with the user or role that would not only mean millions of permissions

Re: Active directory, map roles and permissions to use with camel-shiro

2016-07-14 Thread scSynergy
I do not see any RolePermissionResolver attached to your activeDirectoryRealm which would look something like this: rolePermissionResolver = de.scsynergy.elementary.qi.shiro.ActiveDirectoryRolePermissionResolver activeDirectoryRealm.rolePermissionResolver = $rolePermissionResolver In order for

Re: Basic Digest Auth with Shiro

2016-07-13 Thread scSynergy
The following screenshot shows what Firefox logs when doing Basic Authentication with Shiro and I am convinced Chrome does not / should not filter out any related packages. Digest Authentication and Basic Authentication work almost identically so if Chrome does not log that 401 HTTP response, then

Re: Attribute-based access control

2016-07-07 Thread scSynergy
Sounds like a great idea. And while I am pretty sure you are planning to implement this and only forgot to mention it, I think we would need '$role' in addition to '$user'. Concerning 'and Integer getClearanceLevel()' I would suggest a slightly more versatile approach where getClearanceLevel()

Re: How To Extend BasicHttpAuthenticationFilter and configured it in spring based application ??

2016-07-07 Thread scSynergy
That exception occurs when your Shiro environment has not been initialized correctly. -- View this message in context: http://shiro-user.582556.n2.nabble.com/How-To-Extend-BasicHttpAuthenticationFilter-and-configured-it-in-spring-based-application-tp7581092p7581094.html Sent from the Shiro

Re: [ANNOUNCE] Community Update: Working on 1.3 Release + Dedicated Shiro Staff

2016-06-28 Thread scSynergy
Cool, that certainly is good news. -- View this message in context: http://shiro-user.582556.n2.nabble.com/ANNOUNCE-Community-Update-Working-on-1-3-Release-Dedicated-Shiro-Staff-tp7581077p7581079.html Sent from the Shiro User mailing list archive at Nabble.com.

Re: Shiro and hashbang URLs

2016-06-15 Thread scSynergy
I suspect the problem arises from Shiro interpreting the '#' sign as the start of a comment, so you might want to try and escape it '\#'. Or maybe you can use some other character instead of the # sign in your URLs? -- View this message in context:

Re: Shiro Path Filter doesn't work

2016-04-22 Thread scSynergy
The URI you are calling seems weird as it is missing the context root a.k.a. the name of the application. I would have expected to see something like http://localhost:8080/MyApplicaion/callback. Apart from that Shiro filters are subclasses of

Re: apply shiro to backend or frontend?

2016-04-21 Thread scSynergy
If you want to use Shiro on the frontend, too, and have backend and frontend share their authentication state, then you would need to use ehcache and either terracotta or hazelcast on both machines to synchronize Shiro sessions between frontend and backend servers. -- View this message in

Re: apply shiro to backend or frontend?

2016-04-21 Thread scSynergy
Your frontend server only serves up the html, css and javascript page, right? Then you can either code your html / javascript to authenticate to your backend and store the Shiro session cookie with the client's web browser or have your frontend serve as a proxy for authentication by passing

Re: Questions about "poor mans" SSO

2016-04-11 Thread scSynergy
If applications reside on different cluster nodes, then yes, you will need either terracotta or hazelcast. -- View this message in context: http://shiro-user.582556.n2.nabble.com/Questions-about-poor-mans-SSO-tp7581009p7581017.html Sent from the Shiro User mailing list archive at Nabble.com.

Re: Questions about "poor mans" SSO

2016-04-07 Thread scSynergy
Are we talking web applications here or not? Because, if we are talking about web applications hosted on an application server, then you can have the application server supply the required class 'com.john.appone.Person' instead of packaging it along with the application. This way any web

Re: Shiro and SOAP WS

2016-04-05 Thread scSynergy
Since you have no web.xml in a cxf project you need a class which extends EnvironmentLoaderListener to initialize Shiro. Here is our class that we use - I omitted everything not related to Shiro from this posting (we use https://ops4j1.jira.com/wiki/display/PAXSHIRO/OPS4J+Pax+Shiro for CDI

Re: Using Shiro in OSGi and registering realms dynamically

2016-04-05 Thread scSynergy
I am not sure whether this information will help you, but here is some code we use to initialize Shiro programmatically from an entry in MongoDB (we use https://ops4j1.jira.com/wiki/display/PAXSHIRO/OPS4J+Pax+Shiro for CDI integration). Notice how we add the realm 'CamelRealm.CAMELREALM (=

Re: Apache shiro with microservices

2016-03-29 Thread scSynergy
This post here was a great starting point to get SSO working across multiple war files. I did have to adjust some things because I use WildFly instead of Glassfish application server:

Re: Help - 401 (Unauthorized) but using full access in ini file

2016-01-05 Thread scSynergy
I noticed some bugs in 9.0.2 which are not present in 9.0.1 - maybe the errors are related to the specific WildFly version? -- View this message in context: http://shiro-user.582556.n2.nabble.com/Help-401-Unauthorized-but-using-full-access-in-ini-file-tp7580896p7580900.html Sent from the Shiro

Re: RMDS based SessionDao implemention

2015-12-18 Thread scSynergy
Concerning the session, maybe this line of code will help you which we use to reconstruct a subject from its session id (this is needed because we use multiple Apache Camel contexts): Subject subject = new Subject.Builder().sessionId(shiroSessionId).buildSubject(); where shiroSessionId has

Re: Webapp LDAP for Authentication and INI for Authorization

2015-12-08 Thread scSynergy
No, this will not work since roles and permissions from the ini file are only applied if authentication is done via ini file, too. Aside from that, ini file authentication and authorization are not meant to be used for production uses but for quick and dirty development. In a production

Re: Shiro web in JSF Page not working

2015-11-12 Thread scSynergy
You could have a look at: https://ops4j1.jira.com/wiki/display/PAXSHIRO/JSF+Support -- View this message in context: http://shiro-user.582556.n2.nabble.com/Shiro-web-in-JSF-Page-not-working-tp7580779p7580847.html Sent from the Shiro User mailing list archive at Nabble.com.

Re: [newbie] Search for users or roles

2015-11-10 Thread scSynergy
What do you plan to use as a backend for authentication and authorization - be it with Shiro or without? I am asking this because if you have your user and role information stored in some data store (database, ldap ...) anyhow then all you need to do is keep track of who is currently logged in in

Re: Shiro and Primefaces Push (atmosphere)

2015-11-03 Thread scSynergy
This happens whenever code is executed for which Shiro has not been initialized properly beforehand. We had some issues with Primefaces Push (atmosphere), too, so we simply wrote our own websocket code for push functionality. Research on the internet brings up statements, that Shiro would break

Re: login button and custom realm

2015-10-26 Thread scSynergy
Here is what our login methods look like (MongoDB realm): public void login() { try { AuthenticationToken at = (new UsernamePasswordToken(username, password, false)); subject.login(at);

Re: Shiro and orientdb (realm config)

2015-10-26 Thread scSynergy
You have to write your own realm: public class MongoRealm extends AuthorizingRealm implements Serializable { @Override protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection pc) { // retrieve user's roles and permissions from database, then

Re: Working with isPermitted(PrincipalCollection, Permission)

2015-10-07 Thread scSynergy
Of course we all know how to implement AuthorizingRealm; this whole forum is full of examples on how to do it. Two examples I found in under 15 seconds: http://shiro-user.582556.n2.nabble.com/Example-Shiro-MongoDB-Realm-td7579029.html

Re: LDAP for authentication only and query authorization information by JDBC

2015-10-05 Thread scSynergy
http://shiro-user.582556.n2.nabble.com/Example-Shiro-Active-Directory-Realm-with-role-gt-permission-mapping-td7579030.html -- View this message in context: http://shiro-user.582556.n2.nabble.com/LDAP-for-authentication-only-and-query-authorization-information-by-JDBC-tp7580797p7580798.html

Re: Best Way to Add Multiple Fields to Subject?

2015-10-05 Thread scSynergy
I do not know whether anyone would consider it best practice, but we keep Shiro subjects separate from any additional information. Instead we have a CDI bean which is initialized on login using the subject principal's name - which to this end obviously has to be unique - and then look that user up

Re: Securing separate Web App and Web Services

2015-09-21 Thread scSynergy
I use EhCache for this. Here is where I got my information from: http://shiro-user.582556.n2.nabble.com/Example-Shiro-SSO-for-multiple-WAR-files-with-EhCache-on-Glassfish-td7579037.html -- View this message in context:

Re: How to implement Dynamic roles and permissions in apache shiro

2015-09-15 Thread scSynergy
1. Your realm reads its users, roles and permissions from some backend system (e. g. database). So user A would have a role R which has the VIEW permission. Now, all you need do is change the permission of role R from VIEW to READ and WRITE inside the database. This change will only take effect

Re: Customizing error messages for FormAuthenticator

2015-09-10 Thread scSynergy
I think you would need to do programmatic login so that you can catch the individual exceptions that may be thrown. public void login() { try { AuthenticationToken at = (new UsernamePasswordToken(username, password, false)); subject.login(at); } catch

Re: Dynamic Authorization

2015-09-10 Thread scSynergy
"I can get the list of groups(roles) for the user and could use that to populate the GroupPermission object, but there's no access info in LDAP for the user so I don't know where/how to insert the access that a user needs to complete this task." You might be able to use a RolePermissionResolver

Re: How implement a Realm in Shiro ?

2015-09-09 Thread scSynergy
Here is an example for a MongoDB realm: http://shiro-user.582556.n2.nabble.com/Example-Shiro-MongoDB-Realm-td7579029.html -- View this message in context: http://shiro-user.582556.n2.nabble.com/How-implement-a-Realm-in-Shiro-tp7580692p7580698.html Sent from the Shiro User mailing list archive

Re: Explanation of this shiro.ini

2015-09-09 Thread scSynergy
[main] // is there a line missing which would look something like 'shiro = org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter' ? shiro.loginUrl = /login.jsp // this line tells Shiro what to do when an unauthenticated user tries to acces a secured page: redirect the user to /login.jsp

Re: Dynamic Authorization

2015-09-09 Thread scSynergy
You can verify whether a user / role has access to the record by including these lines at the very beginning of the method which retrieves it from your database: Set permissions = new HashSet<>(); permissions.add(new WildcardPermission("record:read:user")); permissions.add(new

Re: Strange Sha256Hash implementation

2015-09-09 Thread scSynergy
As far as I know Shiro uses the crypto libraries included in the JDK and just exposes them in a more user friendly way. -- View this message in context: http://shiro-user.582556.n2.nabble.com/Strange-Sha256Hash-implementation-tp7580691p7580700.html Sent from the Shiro User mailing list archive

Re: Why doesn't the following work ?

2015-09-09 Thread scSynergy
authc.successUrl means after the authc filter has successfully validated the user redirect her to /home.jsp /login.jsp = anon means do not apply any filter to /login.jsp, not even authc, which means authc is never called and therefore never notices a successful login attempt and therefore does not

Re: Explanation of this shiro.ini

2015-09-09 Thread scSynergy
Yes - concerning the servlet Yes - concerning question 1. Yes - concerning question 2. No, instead you should use authc.loginUrl = /login.xhtml which tells Shiro to exempt '/login.xhtml' from permission checks. -- View this message in context:

Re: Destroy SessionScoped CDI beans during Shiro logout

2015-08-12 Thread scSynergy
FacesContext.getCurrentInstance().getExternalContext().invalidateSession(); throws an UnkownSessionException because subject.logout() has already invalidated the Shiro session SSOcookie. The ExternalContext does not have access to the JSESSIONID session. -- View this message in context:

Re: Destroy SessionScoped CDI beans during Shiro logout

2015-08-12 Thread scSynergy
We found a solution to our problem: We implemented an HttpSessionListener whose sessionCreated(HttpSessionEvent se) method fires when the JSESSIONID session is created and we additionally call subject.getSession() to retrieve the Shiro session 'SSOcookie'. Then we save both to an

Re: Destroy SessionScoped CDI beans during Shiro logout

2015-08-10 Thread scSynergy
Update It seems as though the problem arises from using org.apache.shiro.web.session.mgt.DefaultWebSessionManager in combination with cookie = org.apache.shiro.web.servlet.SimpleCookie cookie.name = SSOcookie The result is 2 different sessions with 2 different session cookies and 2 redundant

Destroy SessionScoped CDI beans during Shiro logout

2015-08-06 Thread scSynergy
I have the problem that session scoped beans are not destroyed before the session times out (30 minutes). Therefore I have two questions regarding the following logout procedure: 1. Is this the right way to use shiro logout (see logout() below) 2. What would be the proper way to destroy

Re: Authenticating users via LDAP with Shiro

2015-07-10 Thread scSynergy
If with 'LDAP' you mean 'Active Directory', then this thread might help: http://shiro-user.582556.n2.nabble.com/Example-Shiro-Active-Directory-Realm-with-role-gt-permission-mapping-td7579030.html -- View this message in context:

Re: Shiro filter with Jaxrs server

2015-07-10 Thread scSynergy
Just on a side-note, /users/** = authcBasic leaves your user-password as plain-text and therefor totally vulnerable to eavesdropping. In production environments I suggest you change that line to /users/** = ssl[insert your port number here], authcBasic for instance my server /users/** =

Re: Getting Specific Information from the Authorization Process

2015-07-01 Thread scSynergy
I do not know whether my way of doing things is better but I will describe it anyway: I wrote Facade / DAO methods whose invocations are restricted to certain Permissions; in your case that would look something like: // method invocation is restricted to the any:view Permission which I presume

Re: Use the same sessionDAO between different webapps

2015-06-22 Thread scSynergy
Your webapps are not sharing their sessions with each other. You can use EhCache to do that like it is described here: http://shiro-user.582556.n2.nabble.com/Example-Shiro-SSO-for-multiple-WAR-files-with-EhCache-on-Glassfish-td7579037.html One important thing to keep in mind is to place some of

Re: Authentication problem on Glassfish 4.0

2015-06-17 Thread scSynergy
I doubt this is the problem, but will ask nevertheless: Maybe character encoding is configured differently on both platforms UTF8 versus ISO-something? The entered credentials would not match the database's on occasion in this case. -- View this message in context:

Re: Simple instructions on Shiro with GWT application

2015-06-01 Thread scSynergy
Shiro starts to shine when the features you need are not provided by the other authentication and authorization frameworks, e. g. NoSQL support or your users and roles are in different relational databases or one authentication framework to serve web and non-web applications simultaneously. These

Re: Is shiro still a good choice (JSF+CDI-JAX-WS ejb)

2015-05-20 Thread scSynergy
I use Shiro with JEE7 on Wildfly in combination with https://github.com/ops4j/org.ops4j.pax.shiro and still have not found any security framework that is as lightweight, flexible and easy to use as Shiro. But I sure hope that CDI will be officially supported by Shiro in version 2. -- View this

Re: Shiro displaying wrong user data after 2nd authentication

2015-04-01 Thread scSynergy
The only thing that I noticed is that you login via the security manager this.securityManager.login(this.subject, token); whereas I login via the subject subject.login(new UsernamePasswordToken(username, password, isRemembered)); I do not know whether both ways produce the same results. On a

Re: How to predefine a role/permission mapping outside realms?

2015-03-10 Thread scSynergy
In this example the author loads roles and their corresponding permissions from MongoDB inside his custom made Shiro realm: http://shiro-user.582556.n2.nabble.com/Example-Shiro-MongoDB-Realm-td7579029.html Basically any Realm that extends AuthorizingRealm

Re: How to predefine a role/permission mapping outside realms?

2015-03-10 Thread scSynergy
Regarding your second question this might help: http://shiro-user.582556.n2.nabble.com/Example-Shiro-Active-Directory-Realm-with-role-gt-permission-mapping-td7579030.html -- View this message in context:

Securing a SOAP webservice but leaving wsdl open to anonymous

2015-02-16 Thread scSynergy
Hi, I have been trying to secure my SOAP webservices with Apache Shiro but I am stuck: I managed to either restrict everything or nothing, but what I want is to have everything secured except for access to the wsdl which should be open to unrestricted access. /SoapService?wsdl should be open to

Re: Shiro support for XSS

2015-01-30 Thread scSynergy
Correct me if I am wrong, but Apache Shiro does *not* secure your web application against XSS. Instead Apache Shiro itself is invulnerable to XSS - meaning e. g. Javascript attacks targeting Shiro will not succeed. -- View this message in context:

Re: Controlling Permission Granting

2014-12-15 Thread scSynergy
In order to grant a permission to a role, you need a method. This method in turn may only be executed by roles with a certain permission. public void grant(Role role, Permission permission) { org.apache.shiro.subject.Subject subject = SecurityUtils.getSubject(); if

Re: Help with shiro and jEE (JAX-RS - Jersey / EJB / JPA on Glassfish 4.1)

2014-11-12 Thread scSynergy
1. I suppose you are coding a project which does not have a web.xml and are wondering how to initialize Shiro. I have not done this myself without web.xml but assume you must subclass org.apache.shiro.web.env.EnvironmentLoaderListener and attach the annotation @WebListener to this subclass to have

Re: shiro group to role mapping with ldap users

2014-11-04 Thread scSynergy
This example is for active directory which is an ldap server at its core, maybe it can get you started: http://shiro-user.582556.n2.nabble.com/Example-Shiro-Active-Directory-Realm-with-role-gt-permission-mapping-td7579030.html -- View this message in context: