Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (14:17:43) pedroigor: ping
- (14:22:10) vwjuicew: pong
- (14:23:48) pedroigor: I'm getting some errors when building picketlink-issue
- (14:23:50) pedroigor: mvn install -Dmaven.test.skip=true -Denvironment=dev -Pjetty
- (14:24:28) vwjuicew: yes, which ones
- (14:25:27) pedroigor: let me run again
- (14:27:03) pedroigor: http://pastebin.com/br3Pqc3Q
- (14:27:50) vwjuicew: MM I think that has to do with Java version, are you using 1.6 ?
- (14:28:01) pedroigor: tried with 1.6 and 1.7
- (14:28:42) vwjuicew: ok, give me a sec, I'll ask somebody that has already fought this in the past
- (14:32:45) vwjuicew: maybe your maven is using a different java version. mvn --version and java -version give you the same java version ?
- (14:33:19) pedroigor: do I need to used 1.6 or 1.7 ?
- (14:34:31) vwjuicew: I use 1.7
- (14:34:56) vwjuicew: in the pom.xml is has 1.7 as java version
- (14:35:10) vwjuicew: you can try to set it to 1.6 in the pom
- (14:35:21) vwjuicew: and use 1.6
- (14:43:12) pedroigor: still failing ..
- (14:43:57) vwjuicew: what's your output for mvn --version and java -version ?
- (14:48:51) pedroigor: Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 12:22:22-0300)
- (14:48:53) pedroigor: Maven home: /pedroigor/java/tools/apache-maven
- (14:48:55) pedroigor: Java version: 1.7.0_45, vendor: Oracle Corporation
- (14:48:57) pedroigor: Java home: /pedroigor/java/sdk/jdk1.7.0_45/jre
- (14:48:59) pedroigor: Default locale: en_US, platform encoding: UTF-8
- (14:49:01) pedroigor: OS name: "linux", version: "3.14.4-200.fc20.x86_64", arch: "amd64", family: "unix"
- (14:49:03) pedroigor: =================
- (14:49:07) pedroigor: java version "1.7.0_55"
- (14:49:09) pedroigor: OpenJDK Runtime Environment (fedora-2.4.7.0.fc20-x86_64 u55-b13)
- (14:49:11) pedroigor: OpenJDK 64-Bit Server VM (build 24.51-b03, mixed mode)
- (14:50:47) vwjuicew: could you try chaging your JAVA_HOME to the 1.7.0._45 from Oracle ?
- (14:51:11) vwjuicew: export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_45
- (14:51:53) pedroigor: did that ...
- (14:52:47) vwjuicew: and you still get OpenJDK when doing java -version ?
- (14:53:00) vwjuicew: give a sec then
- (14:53:20) pedroigor: no, now it is oracle
- (14:54:39) vwjuicew: ok, and you still get the error :/ ?
- (14:55:32) pedroigor: yes
- (14:58:54) vwjuicew: :S sorry if this sounds stupid or desperate, but can you try a mvn clean, and try again haha
- (14:59:07) pedroigor: i did that already :)
- (14:59:19) pedroigor: is it working for you, right ?
- (14:59:51) vwjuicew: yes, we only had that problem when running the application once, never compiling
- (15:00:12) vwjuicew: it happened to us when we compile with one version, but tried to run it with other
- (15:00:30) pedroigor: I'm going to build using a fresh maven repo ..
- (15:00:47) vwjuicew: mm ok, hope that helps
- (15:19:26) vwjuicew: no luck right? maybe changing your PATH ?
- (15:19:40) pedroigor: maven is downaloding the whole internet :)
- (15:19:46) pedroigor: downloading
- (15:19:56) vwjuicew: hahah
- (15:20:02) pedroigor: give me a few more minutes ..
- (15:20:23) vwjuicew: I'll have to commit something anyways
- (15:20:32) vwjuicew: it just failed after I downloaded the jars again
- (15:23:19) pedroigor: what is failing ?
- (15:23:25) pedroigor: build ?
- (15:28:23) vwjuicew: yes, something about errai
- (15:32:07) pedroigor: the same erro as mine ?
- (15:32:10) pedroigor: error
- (15:33:08) vwjuicew: no
- (15:37:15) vwjuicew: did you get it again ?
- (15:37:40) vwjuicew: go a git pull origin master though, I've just pushed something
- (15:50:36) pedroigor: almost finish ...
- (15:50:41) pedroigor: ok
- (15:52:30) vwjuicew: did it compile ?
- (15:52:45) pedroigor: going to fetch your changes now
- (15:54:02) pedroigor: looks fine now ...
- (15:54:14) pedroigor: you were hidden the candy, han ?
- (15:54:16) pedroigor: :)
- (15:55:46) pedroigor: how do I change the datasource ?
- (15:55:52) vwjuicew: haha no, I don't know why it's working now
- (15:56:07) vwjuicew: hm for jetty theres a file
- (15:56:34) vwjuicew: src/jetty/WEB-INf/jetty-env.xml
- (15:56:53) vwjuicew: and for jboss, you need to set it in the standalone.xml
- (15:57:04) pedroigor: can you change to use hsqldb instead ?
- (15:57:53) vwjuicew: hm let me try
- (16:06:18) vwjuicew: ok, trying it out
- (16:09:37) pedroigor: got it :)
- (16:09:42) pedroigor: btw, r u using linux ?
- (16:09:57) vwjuicew: yes
- (16:10:05) vwjuicew: I've pushed it already
- (16:10:15) pedroigor: how do you install the gwt dev plugin ?
- (16:10:39) pedroigor: is it only available for firefox ?
- (16:10:52) vwjuicew: ohh, no, for chrome too
- (16:11:21) pedroigor: Sorry, the GWT Developer Plugin no longer works with Chrome on Linux
- (16:11:28) vwjuicew: https://chrome.google.com/webstore/detail/gwt-developer-plugin/jpjpnpmbddbjkfaccnmhnkdgjideieim?hl=en
- (16:12:08) pedroigor: NPAPI plugins are not supported. ?
- (16:13:06) vwjuicew: hm yeah I think I had some troubles with it
- (16:13:12) vwjuicew: let me google a little bit more
- (16:13:21) pedroigor: trying something here ..
- (16:13:24) pedroigor: too
- (16:16:33) pedroigor: i think it worked now ..
- (16:16:35) pedroigor: let me test
- (16:17:00) vwjuicew: ok
- (16:17:38) pedroigor: it as added, but still asks for the plugin when trying:
- (16:17:40) pedroigor: http://127.0.0.1:8888/App.html?gwt.codesvr=127.0.0.1:9997
- (16:21:08) vwjuicew: https://code.google.com/p/google-web-toolkit/issues/detail?id=7778#c5 ?
- (16:27:59) pedroigor: what is your chrome version ?
- (16:28:03) pedroigor: and firefox ?
- (16:29:37) vwjuicew: I donт use firefox
- (16:29:52) vwjuicew: but you can try, it should work as well
- (16:30:06) vwjuicew: you just have to change a line in the App.gwt.xml file, so let me know
- (16:30:21) vwjuicew: my chrome Version 34.0.1847.137
- (16:30:36) pedroigor: humm ... mine is 35
- (16:30:39) pedroigor: let me downgrade
- (16:32:14) vwjuicew: hm I don't think that'll help :/ try firefox
- (16:32:25) pedroigor: ok
- (16:37:27) pedroigor: ok
- (16:37:44) pedroigor: need to change App.gwt.xml
- (16:37:58) pedroigor: <set-property name="user.agent" value="gecko1_8" /> ?
- (16:38:30) vwjuicew: yes, and you can comment "safari" so it takes less time to compile
- (16:38:44) pedroigor: may I ask you something ?
- (16:38:48) vwjuicew: yes
- (16:39:01) pedroigor: why are you guys using gwt and errai ? any specific requirement ?
- (16:39:23) vwjuicew: no, errai nees gwt, for what I understand
- (16:39:26) vwjuicew: needs*
- (16:39:29) pedroigor: yeah ..
- (16:39:44) vwjuicew: oh, you mean, why don't we use, jsf or some other ?
- (16:39:58) pedroigor: actually, just why you are using gwt :)
- (16:40:10) pedroigor: btw, got the login page !
- (16:40:29) vwjuicew: yey, so now I don't know how to generate a user in hte hsqsl
- (16:40:39) vwjuicew: let me try add the register page
- (16:40:42) vwjuicew: so you can create users
- (16:46:59) vwjuicew: we use gwt because errai works on top of it, we need it so errai works. At least that's what I know
- (16:47:05) pedroigor: i know your issue
- (16:47:14) pedroigor: jetty is not resolving the EntityManager
- (16:47:25) pedroigor: i mean, injecting when using @PersistenceContext
- (16:47:38) vwjuicew: oh, but I instantiated manually
- (16:47:51) pedroigor: yeah, that is also giving an error
- (16:48:03) pedroigor: telling that could not find the datasource in jndi ..
- (16:48:05) pedroigor: etc ..
- (16:51:04) vwjuicew: mm I don't get that. did you pull the hsqldb changes ?
- (16:51:13) pedroigor: let me get yours ..
- (16:52:36) pedroigor: another issue is ..
- (16:52:59) pedroigor: you are using the same EM
- (16:53:12) pedroigor: and producing it only during startup ..
- (16:53:27) pedroigor: i think you need a fresh one each time the app requests one ..
- (16:53:36) vwjuicew: the picketlink one ?
- (16:53:41) vwjuicew: yeah maybe
- (16:53:42) pedroigor: yes
- (16:53:58) pedroigor: how are you doing with the pu-magick ?
- (16:54:15) vwjuicew: it's in commonDAO.java
- (16:54:25) vwjuicew: we get a new one
- (16:54:45) vwjuicew: only when we delete some entity
- (16:55:00) vwjuicew: we had issues over a month ago, and right now is stable
- (16:55:43) vwjuicew: we had only one I think and we tried getting a new one each time, but that also brought us some problem
- (16:56:02) pedroigor: you need something like OpenEntityManagerInViewFilter ..
- (16:56:35) pedroigor: the worst case ..
- (16:56:49) pedroigor: I know how to handle that ... the only problem is manage transactions ...
- (16:59:13) pedroigor: why u need a UserDAO
- (16:59:15) pedroigor: ?
- (16:59:23) pedroigor: you can just use PL IDM ?
- (16:59:45) vwjuicew: we had that from before
- (17:00:10) vwjuicew: AND we don't completely understand PL yet so many things may be wrong
- (17:00:29) pedroigor: i see ..
- (17:03:52) pedroigor: which class is invoked when you hit the login button ?
- (17:04:57) vwjuicew: ok, so that is an errai security class, which calls picketlink
- (17:05:21) vwjuicew: (I've just pushed changes so you can create a user, and after creating it, it shows the login page below)
- (17:05:40) pedroigor: ok
- (17:17:18) vwjuicew: when login is clicked, PicketlinkAuthenticationService#login is called
- (17:17:40) pedroigor: ok
- (17:17:41) vwjuicew: and that calls out MagickAuthenticator :P
- (17:17:48) pedroigor: there are some strange behaviors ...
- (17:17:51) pedroigor: like ..
- (17:18:07) pedroigor: everytime you hit login the IDM configuration is initialized over and over again ..
- (17:18:15) vwjuicew: hm
- (17:18:16) pedroigor: ideally, this should be done once ..
- (17:18:30) vwjuicew: yeah, I think that's out fault
- (17:18:38) vwjuicew: the code is in MagickAuthenticator
- (17:18:48) pedroigor: I've removed this authc ..
- (17:18:52) pedroigor: I don't think you need it ..
- (17:19:07) vwjuicew: yeah I know, you told me in the post
- (17:19:44) vwjuicew: but didn't had time to understand and configure IDM to check passwords like BCrypt
- (17:25:57) pedroigor: also ..
- (17:26:23) pedroigor: how do you get the EntityManagerFactory built during the app startup ?
- (17:26:31) pedroigor: I'm not a jetty expert :)
- (17:27:14) pedroigor: is possible to run this app in EAP ?
- (17:28:21) vwjuicew: impossible on jetty I think.
- (17:28:33) vwjuicew: you mean the @Startup from ejb ?
- (17:28:41) vwjuicew: that doesn't work with jetty
- (17:29:17) pedroigor: is possible to run this app using EAP 6 ?
- (17:29:23) vwjuicew: I use a wildfly :/
- (17:29:28) pedroigor: cool
- (17:29:28) vwjuicew: didn't try with 6
- (17:29:32) pedroigor: how do I do ?
- (17:29:36) pedroigor: just deploy the war ?
- (17:29:51) vwjuicew: you need to compile with -Pjboss7
- (17:29:58) vwjuicew: and do a mvn clean before
- (17:30:25) pedroigor: and to deploy ?
- (17:30:34) vwjuicew: yes, just deploy the war, and you won't need gwt dev mode
- (17:31:22) pedroigor: i think that would help ..
- (17:32:10) vwjuicew: and you can add all the @startup @singleton @localBean you want haha
- (17:32:59) pedroigor: are you going to use wildfly or jetty in production ?
- (17:33:14) vwjuicew: we use jboss
- (17:33:19) pedroigor: nice
- (17:34:04) vwjuicew: jetty for dev because it's a little faster for redeploying and currently debug on server side isn't working in jboss, but it worked before.
- (17:35:54) pedroigor: which version of wildfly ?
- (17:36:05) pedroigor: getting some errors when deploying ..
- (17:36:43) vwjuicew: mm 7.1.1
- (17:37:23) vwjuicew: JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
- (17:39:13) vwjuicew: you don't have access here right ? https://bitbucket.org/magick/wildfly/src
- (17:39:46) pedroigor: actually, this is AS 7.1.1, not wildfly ..
- (17:39:52) pedroigor: is a old version of JBoss AS
- (17:40:11) pedroigor: man ...
- (17:40:29) vwjuicew: ups sry, we have it as wildfly in the repo
- (17:40:43) pedroigor: first of all, you need to decide the target container ...
- (17:40:59) pedroigor: specially if you consider how transactions are managed
- (17:41:08) pedroigor: you are using resource local
- (17:41:47) pedroigor: and it seems you don't have a solution to manage them (begin/commit/rollback) automatically ..
- (17:41:57) pedroigor: but you need to do that by yourself, am i right ?
- (17:41:58) vwjuicew: nope
- (17:42:03) vwjuicew: yes
- (17:43:24) pedroigor: is possible to intercept all requests in errai from an interceptor or filter or whatever ?
- (17:44:34) vwjuicew: http requests? hm I guess haven't done that so far
- (17:45:31) pedroigor: did you see this ?
- (17:45:33) pedroigor: https://github.com/errai/errai/tree/master/errai-demos/errai-jpa-demo-todo-list
- (17:45:53) vwjuicew: yes
- (17:47:57) pedroigor: it works ?
- (17:49:42) vwjuicew: I haven't deployed it
- (17:50:01) vwjuicew: it should...
- (17:53:47) vwjuicew: actually I spent more time looking at this demo in the past. https://github.com/errai/errai/tree/master/errai-demos/errai-security-demo
- (17:53:47) vwjuicew: and not that much with the one you just gave. I don't remember seeing all that picketlink stuff in the example so I must have missed it
- (18:20:06) pedroigor: maybe you should try it out ..
- (18:20:56) vwjuicew: ok, I'll give it a shot tomorrow
- (18:21:33) vwjuicew: I'll talk with xybrek so he looks at it (he wakes up in a few hours )
- (18:21:44) pedroigor: ok
- (18:22:14) vwjuicew: you say that there we'll find the solution for our current issue ?
- (18:22:27) vwjuicew: org.picketlink.idm.IdentityManagementException: PLIDM000406: Partition [class org.picketlink.idm.model.basic.Realm] not found with the given name [default].
- (18:23:02) pedroigor: the cause of your issue is how JPA is being used ..
- (18:23:06) pedroigor: that is one point ..
- (18:23:43) pedroigor: we have a plenty of quickstarts for non-errai apps ...
- (18:23:47) pedroigor: basically, what they do is:
- (18:23:52) pedroigor: 1) user do a request
- (18:24:01) pedroigor: 2) a EntityManager is associated with that request
- (18:24:17) pedroigor: 3) you call picketlink
- (18:24:25) pedroigor: 4) transaction is commited
- (18:24:33) pedroigor: you are missing #2 and #3
- (18:25:00) vwjuicew: ok.
- (18:28:02) vwjuicew: and regarding the custom Authenticator, how can we make that IDM checks the password without using a custom auth, if the all the data (username and password) are saved in tables that correspond to custom entities. I mean we have nothing stored in the picketlink related tables, will those get populated when we do identityManager.add(user) ?
- (18:28:36) pedroigor: i think I can give you an overview about PL ...
- (18:28:48) pedroigor: documentation is a good source of information too ...
- (18:28:59) pedroigor: but if you want I can give you a overview ..
- (18:29:02) pedroigor: now
- (18:29:28) vwjuicew: yes, please (I've read the docs but they weren't clear enought for me, I feel a little lost yet)
- (18:29:31) pedroigor: so you can understand it better and replicate the information to your team ..
- (18:30:03) pedroigor: ok, let's start ...
- (18:30:48) pedroigor: PicketLink is about two main modules/libraries
- (18:30:58) pedroigor: 1) The Base Module
- (18:31:03) pedroigor: 2) The IDM Module
- (18:31:29) pedroigor: The Base Module is a integration module, which provides CDI support for most of PicketLink features.
- (18:31:44) pedroigor: for example, authentication using Identity
- (18:31:59) pedroigor: injection of IDM components such as IdentityManager, RelationshipManager, etc ..
- (18:32:28) pedroigor: when you configure PicketLink to your project, you'll get all that ...
- (18:33:02) pedroigor: by default, when your application starts PicketLink tries to create a default IDM configuration for you
- (18:33:11) pedroigor: using a file-based identity store
- (18:33:23) pedroigor: an identity store is where you store users, roles, groups, etc ..
- (18:33:27) pedroigor: ok so far ?
- (18:33:36) vwjuicew: yes
- (18:33:40) pedroigor: ok
- (18:34:06) pedroigor: so, if you don't provide any configuration, you can start injecting:
- (18:34:10) pedroigor: @Inject Identity
- (18:34:16) pedroigor: @Inject IdentityManager
- (18:34:21) pedroigor: @Inject RelationshipManager
- (18:34:25) pedroigor: @Inject PartitionManager
- (18:34:41) pedroigor: the Identity bean is responsible to provide you authentication features.
- (18:34:45) pedroigor: for example:
- (18:36:13) pedroigor: https://github.com/jboss-developer/jboss-picketlink-quickstarts/blob/master/picketlink-authentication-two-factor/src/main/java/org/jboss/as/quickstarts/picketlink/authentication/totp/jsf/LoginController.java
- (18:36:43) pedroigor: this is an example of bean that uses the Identity bean to authenticate an user
- (18:36:57) pedroigor: as you can see, we use a
- (18:36:59) pedroigor: @Inject
- (18:37:01) pedroigor: private DefaultLoginCredentials loginCredentials;
- (18:37:18) pedroigor: to set user credentials
- (18:37:25) pedroigor: credential.setUsername(this.loginCredentials.getUserId());
- (18:37:27) pedroigor: credential.setPassword((Password) this.loginCredentials.getCredential());
- (18:37:33) pedroigor: and when you call identity.login()
- (18:37:51) pedroigor: PL is going to automatically authenticate the user based on the provided credentials
- (18:37:59) pedroigor: ok ?
- (18:38:13) pedroigor: let me give you a more simple example :)
- (18:38:50) pedroigor: https://github.com/picketlink/picketlink/blob/master/tests/src/test/java/org/picketlink/test/authentication/DefaultAuthenticationTestCase.java#L57
- (18:38:51) vwjuicew: yeah, I've tested that usercase in the past, but also with a customAuthenticator
- (18:38:59) pedroigor: cool
- (18:39:01) pedroigor: now ..
- (18:39:18) pedroigor: how PL knows if the credentials are valid ?
- (18:39:25) vwjuicew: the problem I was having back then is that identity didn't hold the session but I suspect that was because of jetty
- (18:39:27) pedroigor: here comes PicketLink IDM
- (18:39:34) pedroigor: probably ..
- (18:39:39) pedroigor: so ..
- (18:39:51) pedroigor: by default, PicketLink provides a IdmAuthenticator
- (18:39:58) vwjuicew: yes
- (18:40:06) pedroigor: which knows how to use PicketLink IDM to query users, check credentials, etc ..
- (18:40:12) pedroigor: that said,
- (18:40:28) pedroigor: in order to start authenticating your users, you just need them stored in IDM.
- (18:41:38) pedroigor: https://github.com/jboss-developer/jboss-picketlink-quickstarts/blob/master/picketlink-authorization-idm-jpa/src/main/java/org/jboss/as/quickstarts/picketlink/authorization/idm/jpa/IDMInitializer.java#L49
- (18:41:53) pedroigor: this is an example of class that creates some default users during startup ..
- (18:42:11) pedroigor: you don't need this, actually:
- (18:42:13) pedroigor: IdentityManager identityManager = this.partitionManager.createIdentityManager();
- (18:42:21) pedroigor: you can just @Inject IdentityManager and use it ..
- (18:42:34) vwjuicew: oh ok
- (18:42:52) pedroigor: now, how do you tell PL IDM to use a database instead of the default file-store ?
- (18:43:13) pedroigor: basically, you just need to provide a configuration for the IDM
- (18:43:19) pedroigor: you can do it in several ways
- (18:43:21) vwjuicew: so when it does
- (18:43:21) vwjuicew: identityManager.add(mary); it saves it to a file ?
- (18:43:36) pedroigor: by default, yes ... if you don't provide any specific configuration.
- (18:43:42) vwjuicew: yes ok
- (18:43:44) pedroigor: like you did providing a JPA configuration ..
- (18:43:48) pedroigor: ok
- (18:44:04) pedroigor: so, your app is configuring IDM using a JPA store, right ?
- (18:44:08) pedroigor: and you did that by doing this:
- (18:44:40) pedroigor: https://github.com/jboss-developer/jboss-picketlink-quickstarts/blob/master/picketlink-authorization-idm-jpa/src/main/java/org/jboss/as/quickstarts/picketlink/authorization/idm/jpa/IDMConfiguration.java
- (18:45:47) pedroigor: but here is one important thing ..
- (18:46:04) pedroigor: if you want to use a default configuration for JPA
- (18:46:15) pedroigor: you just need to add the picketlink-idm-simple-schema to your deployment
- (18:46:29) pedroigor: and produce a @PicketLink EntityManager
- (18:46:31) pedroigor: only that
- (18:47:24) pedroigor: you only need to provide a custom configuration for JPA if the default model provided by PL is not enough ..
- (18:47:40) pedroigor: the default model is that User, Role, Group, Grant, etc types ..
- (18:48:00) pedroigor: and the picketlink-idm-simple-schema provides the default entities to map those types ..
- (18:48:04) pedroigor: ok ?
- (18:48:50) vwjuicew: yes
- (18:53:31) pedroigor: the good thing about using PL IDM is that you can start storing your identities (users, roles, groups) pretty quickly ..
- (18:53:53) pedroigor: and use the same API to store them in different stores
- (18:54:01) pedroigor: or even support multiple stores and partitions ..
- (18:54:21) pedroigor: for example, that error you are getting is because there is no partition to store your users.
- (18:54:45) pedroigor: by default, PL uses a partition with type Realm and name "default".
- (18:54:57) pedroigor: you need a partition to store users, roles, groups, whatever ..
- (18:55:28) pedroigor: during startup, picketlink creates this default partition for you automatically.
- (18:55:40) pedroigor: in your case, it is not being created because of those JPA issues
- (18:56:05) pedroigor: so,
- (18:56:08) pedroigor: in your case ...
- (18:56:15) vwjuicew: so you can have more than one partition in every store ?
- (18:56:21) pedroigor: yeah
- (18:56:27) pedroigor: you can store, for example:
- (18:56:36) pedroigor: users X, P, T, O in Partition A
- (18:56:44) pedroigor: and users A, B, C, D in Partition B
- (18:56:48) pedroigor: the same for roles and groups
- (18:56:59) pedroigor: you can store partition A using a LDAP store
- (18:57:05) pedroigor: and partition B using database
- (18:57:11) pedroigor: there are a lof of combinations ..
- (18:57:18) pedroigor: take a look at this quickstart later ..
- (18:57:23) vwjuicew: yes yes
- (18:57:31) pedroigor: https://github.com/jboss-developer/jboss-picketlink-quickstarts/tree/master/picketlink-authentication-idm-multi-tenancy
- (18:57:34) pedroigor: so ..
- (18:57:46) vwjuicew: but theres not much sense in creating 2 partitions with the same store right ?
- (18:57:58) pedroigor: actually, there is ..
- (18:58:14) pedroigor: if you want to provide a multi-tenant architecture using a single repository ..
- (18:58:19) pedroigor: a SaaS application
- (18:58:32) pedroigor: serving multiple security domains or companies, etc ..
- (18:59:18) vwjuicew: hm ok, nice
- (18:59:38) pedroigor: welll
- (18:59:40) pedroigor: well
- (18:59:43) pedroigor: basically, that is it ..
- (18:59:54) pedroigor: your app is really different than what we're used to
- (19:00:07) pedroigor: it is using gwt with errai, etc ..
- (19:00:14) pedroigor: I'm a newbie on this techs
- (19:00:40) pedroigor: but I really would like to get this working to make sure we're covering this usecase
- (19:01:04) vwjuicew: yeah me too haha
- (19:01:23) pedroigor: given that there is some examples using errai and picketlink from errai team ..
- (19:01:35) pedroigor: i think you guys should take a look on them ..
- (19:01:53) vwjuicew: yes. ok.
- (19:01:55) pedroigor: and give them a try, before trying by yourselves ....
- (19:02:17) vwjuicew: yes :/ sorry about that
- (19:02:42) vwjuicew: so I will consider migrating out users to picketlink model
- (19:02:54) pedroigor: i think is better ..
- (19:03:06) pedroigor: but first, you need to solve that JPA issue ..
- (19:03:17) pedroigor: otherwise you won't be able to use the JPA store
- (19:04:13) vwjuicew: but in case our boss won't accept this, and we use out custom users, authentication will be done by IDM checking the picketlink tables ? Or will it check out custom entities ?
- (19:04:41) pedroigor: you can always provide your own representations to users, roles, etc ..
- (19:05:29) pedroigor: for example ..
- (19:05:31) pedroigor: https://github.com/jboss-developer/jboss-picketlink-quickstarts/blob/master/picketlink-angularjs-rest/src/main/java/com/gr/project/security/model/MyUser.java
- (19:05:37) pedroigor: this app uses a custom user representation
- (19:05:39) pedroigor: MyUser
- (19:06:10) pedroigor: and it is also a good example about how to integrate the identity model managed by PL with your app domain model
- (19:06:23) pedroigor: the type above is associated with a Person
- (19:06:36) pedroigor: which is an entity from that app domain/entity model
- (19:06:43) pedroigor: so everytime we load or store an user
- (19:06:51) pedroigor: we also store/get the associated Person
- (19:07:17) pedroigor: Person is not related with PL, but just an usual JPA entity to store some specific data
- (19:08:06) vwjuicew: yeah, that looks like what we did
- (19:08:17) pedroigor: yeah ..
- (19:08:52) vwjuicew: and, MyUser won't be persisted to a MyUser table right? instead it will be persisted as MyUserTypeEntity because this class 'maps' MyUser ?
- (19:10:34) pedroigor: MyUser is not an Entity ..
- (19:10:45) pedroigor: but is a IdentityType, which is stored by the MyUserTypeEntity
- (19:11:21) pedroigor: but yes, you're right ..
- (19:11:32) pedroigor: look ..
- (19:11:59) pedroigor: what we can do to get you guys trying PL out is use the file store instead
- (19:12:41) pedroigor: later, when you guys find a way to use JPA with errai. you can just switch ..
- (19:13:02) vwjuicew: at startup we should get alll the users from database and convert them to PL entities and save them to the IDM, correct ?
- (19:13:28) vwjuicew: (if we want to use our already stored users ..)
- (19:16:39) pedroigor: ahh ..
- (19:17:02) pedroigor: you already have users stored using your own schema ?
- (19:17:17) vwjuicew: yeap
- (19:17:23) pedroigor: humm ..
- (19:17:40) pedroigor: that makes things more interesting :)
- (19:17:43) pedroigor: well ..
- (19:18:59) pedroigor: PL provides a bunch of JPA annotations that you can use to decorate your existing entities
- (19:19:03) vwjuicew: haha, yes, that's why we were trying to use custom entities, otherwise we would just used simpleSchema
- (19:20:44) pedroigor: that would require some more understanding about the JPA annotations provided by PL
- (19:21:14) pedroigor: so you can create entities based on your existent schema ..
- (19:21:18) vwjuicew: ok, yeah honestly I haven't checked those annotations
- (19:21:30) vwjuicew: oh ok...
- (19:21:45) vwjuicew: you mean PL entities
- (19:21:46) vwjuicew: ?
- (19:22:10) pedroigor: here are they:
- (19:22:43) pedroigor: http://docs.jboss.org/picketlink/2/latest/reference/html/chap-Identity_Management_-_Working_with_JPA.html
- (19:22:47) pedroigor: 8.1.3
- (19:35:06) vwjuicew: (could it be that 8.1.4 has a typo ? it also says 'map entities to IdentityType types'? )
- (19:35:24) pedroigor: 8.1.3. Mapping IdentityType Types
- (19:35:29) pedroigor: yeah, those are the annotations ..
- (19:35:31) pedroigor: btw ..
- (19:35:46) pedroigor: I got your app working with the file store ..
- (19:35:57) pedroigor: that way you can start using PL and understand hwo to use it ..
- (19:36:24) vwjuicew: oh really ? nice, can you commit the changes to another branch ?
- (19:36:38) pedroigor: yeah ..
- (19:37:19) vwjuicew: woohoo :) thank you so much, you didn't need to do it, thanks!
- (19:38:16) vwjuicew: ok, I understand better now, so my idea to 'translate' our users into IDM is, if when authenticating, user is not found, add it to IDM, and eventually all users will be stored in the IDM. Does this make sense ?
- (19:38:39) pedroigor: you may not need that ..
- (19:38:47) pedroigor: that is the while point of PicketLink IDM ..
- (19:38:57) pedroigor: you may integrate it with your existing schema ...
- (19:39:00) pedroigor: for example ..
- (19:39:18) pedroigor: you just apply those JPA annotations from PL to your entities from -extra
- (19:39:20) pedroigor: got it ?
- (19:44:18) vwjuicew: yeah.. but let me ask with an example
- (19:45:27) vwjuicew: we have User (it's a jpa @Entity)
- (19:45:42) vwjuicew: should we make it a non-Entity class ?
- (19:46:40) pedroigor: no, you just need to use the JPA annotations from PicketLink to map it to your UserImpl ..
- (19:46:49) pedroigor: which is a PicketLink IdentityType ..
- (19:46:51) pedroigor: got it ?
- (19:47:53) vwjuicew: so User stays as is, and UserImpl will have the same fields, annotated with PL annotations, and UserImpl extends IdentityType
- (19:48:57) vwjuicew: And then we also have AccountTypeEntity, which is annotated with @IdentityManaged ({UserImpl.class})
- (19:48:57) pedroigor: yeah, but the User is where you are going to put the JPA annotations. As this is the entity class that is going to be used to store UserImpl instances.
- (19:49:07) pedroigor: I can help you guys with this mapping ..
- (19:49:23) pedroigor: but you should first find a way to make JPA work in your app
- (19:49:40) vwjuicew: yeah ok, I will start by the EM problem
- (19:49:49) vwjuicew: but just to wrap this up
- (19:51:26) vwjuicew: User will be a @Entity, and have JPA and PL annotations, and also will be annotated with @IdentityManaged ({UserImpl.class}) ???
- (19:51:46) pedroigor: yeah !
- (19:51:48) pedroigor: exactly :)
- (19:51:53) pedroigor: so you are telling:
- (19:52:17) pedroigor: "Hey PicketLink, this is the entity that is responsible to store UserImpl."
- (19:52:30) vwjuicew: and should it extend IdentityTypeEntity ? or UserImpl should ?
- (19:52:50) pedroigor: UserImpl, as it is the type managed by PL
- (19:53:10) vwjuicew: ok.. and we would get rid of AccountTypeEntity
- (19:53:13) pedroigor: take a look at the AccountTypeEntity
- (19:53:16) pedroigor: yeah
- (19:53:38) pedroigor: you'll see that we have there a @IdentityManaged
- (19:53:39) vwjuicew: ok, so we got this a little wrong haha :/
- (19:53:52) pedroigor: which tells which IdentityTypes are supported by this entity
- (19:54:27) pedroigor: also, you may noticed some other annotations like:
- (19:54:36) pedroigor: @AttributeValue
- (19:54:38) pedroigor: private String loginName;
- (19:54:42) pedroigor: @AttributeValue
- (19:54:44) pedroigor: private String firstName;
- (19:54:48) pedroigor: @AttributeValue
- (19:54:50) pedroigor: private String lastName;
- (19:54:54) pedroigor: @AttributeValue
- (19:54:56) pedroigor: private String email;
- (19:54:58) pedroigor: the @AttributeValue is used to map a column on this entity to a property on the IdentityType
- (19:55:07) pedroigor: so, UserImpl has a loginName getter/setter, right ?
- (19:55:23) pedroigor: and also the Entity
- (19:55:27) vwjuicew: yeah I got that just now when I read the docs about those Annotations
- (19:55:46) pedroigor: so PL is going to automatically get the value from an UserImpl instance and put it in a User entity instance.
- (19:55:48) pedroigor: when you call
- (19:55:51) pedroigor: identityManager.add
- (19:55:58) pedroigor: the same when loading from the IDM
- (19:56:19) pedroigor: PL will get each property from the User entity and put it back in a UserImpl instance ..
- (19:56:24) pedroigor: more clear now ?
- (19:56:52) pedroigor: that is the beauty of PL ...
- (19:56:54) pedroigor: :)
- (19:57:10) pedroigor: you can quickly enable your app to use some IDM features.
- (19:57:14) pedroigor: using a unified API
- (19:57:28) pedroigor: and from a central point ..
- (19:59:02) vwjuicew: yes! beautiful in deed!
- (19:59:39) vwjuicew: just what we need, but we have 3 classes now, so we got it all wrong
- (20:00:17) pedroigor: yeah, it is a bit wrong ..
- (20:00:25) pedroigor: i did not understand some things like:
- (20:00:39) pedroigor: those daos
- (20:00:51) pedroigor: app.server.helper.impl.SessionHelperImpl#getCurrentUser
- (20:00:58) pedroigor: the logic inside that method ..
- (20:01:10) pedroigor: you just need to return the Account
- (20:01:14) vwjuicew: that's from the previous implementation
- (20:01:16) pedroigor: which would be a UserImpl
- (20:01:19) pedroigor: no entity
- (20:01:20) vwjuicew: we were using Shiro
- (20:01:24) pedroigor: the entity is hidden from your app
- (20:01:32) pedroigor: only PL needs to know about them ..
- (20:03:10) vwjuicew: ok, so now we will use UserImpl which is the nonEntity
- (20:03:25) vwjuicew: and leave PL to store it as a User
- (20:03:27) pedroigor: ok
- (20:04:05) vwjuicew: is that the correct use case ?
- (20:07:19) pedroigor: yeah
- (20:07:29) pedroigor: you work only with UserImpl, never the entity
- (20:08:04) vwjuicew: ok, that we were doing the wrong way too
- (20:08:11) pedroigor: yeah
- (20:08:27) pedroigor: forget the entity when writing your security logic
- (20:08:38) vwjuicew: yes, understood
- (20:08:57) pedroigor: so you can use a file store during development, for example ..
- (20:09:03) pedroigor: and in production use a jpa or ldap store
- (20:09:08) pedroigor: with the same code
- (20:09:15) pedroigor: that is the idea ..
- (20:09:43) vwjuicew: I will definitely save this chat
- (20:09:54) vwjuicew: oooooh, that's a good one
- (20:10:19) vwjuicew: but where is the file saved ? does it deletes every time I deploy ?
- (20:10:38) pedroigor: you can delete or not ..
- (20:10:48) pedroigor: look the documentation ...
- (20:10:52) pedroigor: there are examples ..
- (20:11:05) pedroigor: this is what you need to use the file store:
- (20:11:11) pedroigor: @Produces
- (20:11:14) pedroigor: public IdentityConfiguration getConfiguration() {
- (20:11:16) pedroigor: IdentityConfigurationBuilder builder = new IdentityConfigurationBuilder();
- (20:11:20) pedroigor: builder
- (20:11:22) pedroigor: .named("file.store")
- (20:11:24) pedroigor: .stores()
- (20:11:26) pedroigor: .file()
- (20:11:28) pedroigor: .supportType(UserImpl.class)
- (20:11:30) pedroigor: .setCredentialHandlerProperty(CredentialHandler.SUPPORTED_ACCOUNT_TYPES_PROPERTY, UserImpl.class)
- (20:11:32) pedroigor: .supportAllFeatures();
- (20:11:36) pedroigor: return builder.build();
- (20:11:38) pedroigor: }
- (20:11:40) pedroigor: this would recreate the files each time PL starts
- (20:11:42) pedroigor: if you want to preserve state you just set
- (20:11:50) pedroigor: .file()
- (20:11:52) pedroigor: .preserveState(true)
- (20:12:09) pedroigor: then you'll preserve data during redeploys
- (20:12:51) vwjuicew: Nice
- (20:13:25) pedroigor: let me give you the file-based working version to your app ..
- (20:13:30) pedroigor: so you can at least start using it ..
- (20:14:12) vwjuicew: yes, commit it to the git repo if you prefer to do it this way
- (20:21:34) pedroigor: do i have permission ?
- (20:33:45) vwjuicew: sry
- (20:34:07) vwjuicew: mm, I don't know, you probably need to have a user in bitbucket
- (20:34:15) vwjuicew: do you prefer github ?
Advertisement
Add Comment
Please, Sign In to add comment