Author: shane.bryzak(a)jboss.com
Date: 2008-04-03 22:08:22 -0400 (Thu, 03 Apr 2008)
New Revision: 7814
Added:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Authenticator.java
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberRole.java
Removed:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/AuthenticationEvents.java
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberAccount.java
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserAction.java
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserSearch.java
branches/Seam_2_0/src/main/org/jboss/seam/identity-management-2.0.xsd
branches/Seam_2_0/src/main/org/jboss/seam/security/management/
Modified:
branches/Seam_2_0/examples/seamspace/resources/META-INF/security-rules.drl
branches/Seam_2_0/examples/seamspace/resources/WEB-INF/components.xml
branches/Seam_2_0/examples/seamspace/resources/import.sql
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Member.java
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java
branches/Seam_2_0/src/main/org/jboss/seam/security/jaas/SeamLoginModule.java
Log:
JBSEAM-2818
Modified: branches/Seam_2_0/examples/seamspace/resources/META-INF/security-rules.drl
===================================================================
--- branches/Seam_2_0/examples/seamspace/resources/META-INF/security-rules.drl 2008-04-03
21:36:37 UTC (rev 7813)
+++ branches/Seam_2_0/examples/seamspace/resources/META-INF/security-rules.drl 2008-04-04
02:08:22 UTC (rev 7814)
@@ -84,43 +84,3 @@
then
check.grant();
end
-
-rule CreateAccount
- no-loop
- activation-group "permissions"
-when
- check: PermissionCheck(name == "seam.account", action == "create",
granted == false)
- Role(name == "admin")
-then
- check.grant();
-end
-
-rule ReadAccount
- no-loop
- activation-group "permissions"
-when
- check: PermissionCheck(name == "seam.account", action == "read",
granted == false)
- Role(name == "admin")
-then
- check.grant();
-end
-
-rule UpdateAccount
- no-loop
- activation-group "permissions"
-when
- check: PermissionCheck(name == "seam.account", action == "update",
granted == false)
- Role(name == "admin")
-then
- check.grant();
-end
-
-rule DeleteAccount
- no-loop
- activation-group "permissions"
-when
- check: PermissionCheck(name == "seam.account", action == "delete",
granted == false)
- Role(name == "admin")
-then
- check.grant();
-end
\ No newline at end of file
Modified: branches/Seam_2_0/examples/seamspace/resources/WEB-INF/components.xml
===================================================================
--- branches/Seam_2_0/examples/seamspace/resources/WEB-INF/components.xml 2008-04-03
21:36:37 UTC (rev 7813)
+++ branches/Seam_2_0/examples/seamspace/resources/WEB-INF/components.xml 2008-04-04
02:08:22 UTC (rev 7814)
@@ -3,7 +3,6 @@
xmlns:core="http://jboss.com/products/seam/core"
xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:security="http://jboss.com/products/seam/security"
-
xmlns:identity-management="http://jboss.com/products/seam/security/m...
xmlns:drools="http://jboss.com/products/seam/drools"
xmlns:captcha="http://jboss.com/products/seam/captcha"
xmlns:web="http://jboss.com/products/seam/web"
@@ -13,7 +12,6 @@
http://jboss.com/products/seam/persistence
http://jboss.com/products/seam/persistence-2.0.xsd
http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-2.0.xsd
http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-2.0.xsd
-
http://jboss.com/products/seam/security/management
http://jboss.com/products/seam/identity-management-2.0.xsd
http://jboss.com/products/seam/web
http://jboss.com/products/seam/web-2.0.xsd
http://jboss.com/products/seam/drools
http://jboss.com/products/seam/drools-2.0.xsd
http://jboss.com/products/seam/captcha
http://jboss.com/products/seam/captcha-2.0.xsd">
@@ -24,10 +22,8 @@
concurrent-request-timeout="500"
conversation-id-parameter="cid"/>
- <security:identity security-rules="#{securityRules}"/>
-
- <identity-management:jpa-identity-store name="identityStore"
account-class="org.jboss.seam.example.seamspace.MemberAccount"/>
-
+ <security:identity security-rules="#{securityRules}"
authenticate-method="#{authenticator.authenticate}"/>
+
<drools:rule-base name="securityRules">
<drools:rule-files>
<value>/META-INF/security-rules.drl</value>
Modified: branches/Seam_2_0/examples/seamspace/resources/import.sql
===================================================================
--- branches/Seam_2_0/examples/seamspace/resources/import.sql 2008-04-03 21:36:37 UTC (rev
7813)
+++ branches/Seam_2_0/examples/seamspace/resources/import.sql 2008-04-04 02:08:22 UTC (rev
7814)
@@ -1,20 +1,15 @@
-insert into Member (memberid, membername, firstname, lastname, email, tagline, gender,
dob, location, membersince) values (1, 'Mr_Smiley', 'Mr',
'Smiley', 'smiley(a)nowhere.com', 'I smile because I care', 0,
'1953-03-10', '', '2007-01-02')
-insert into Member (memberid, membername, firstname, lastname, email, tagline, gender,
dob, location, membersince) values (2, 'duke', 'duke', 'McDuke',
'duke(a)sun.com', 'I love the smell of coffee', 0, '1995-01-01',
'', '2007-01-04')
-insert into Member (memberid, membername, firstname, lastname, email, tagline, gender,
dob, location, membersince) values (3, 'shadowman', 'shadow',
'man', 'shadowman(a)redhat.com', 'I''m wearing a hat', 0,
'1999-01-01', '', '2007-01-05')
-insert into Member (memberid, membername, firstname, lastname, email, tagline, gender,
dob, location, membersince) values (4, 'mona', 'mona', 'lisa',
'monalisa(a)louvre.fr', 'Some describe me as enigmatic', 1,
'1503-07-01', '', '2007-01-06')
+insert into Member (memberid, username, hashedpassword, membername, firstname, lastname,
email, tagline, gender, dob, location, membersince) values (1, 'demo',
'fe01ce2a7fbac8fafaed7c982a04e229', 'Mr_Smiley', 'Mr',
'Smiley', 'smiley(a)nowhere.com', 'I smile because I care', 0,
'1953-03-10', '', '2007-01-02')
+insert into Member (memberid, username, hashedpassword, membername, firstname, lastname,
email, tagline, gender, dob, location, membersince) values (2, 'duke',
'041cf7cf23d3d372644b707505218fb0', 'duke', 'duke',
'McDuke', 'duke(a)sun.com', 'I love the smell of coffee', 0,
'1995-01-01', '', '2007-01-04')
+insert into Member (memberid, username, hashedpassword, membername, firstname, lastname,
email, tagline, gender, dob, location, membersince) values (3, 'shadowman',
'1bafb3c11c60b0892007c63ac6a321de', 'shadowman', 'shadow',
'man', 'shadowman(a)redhat.com', 'I''m wearing a hat', 0,
'1999-01-01', '', '2007-01-05')
+insert into Member (memberid, username, hashedpassword, membername, firstname, lastname,
email, tagline, gender, dob, location, membersince) values (4, 'mona',
'4af5cab77c62eaec5f87b570f2d2b127', 'mona', 'mona',
'lisa', 'monalisa(a)louvre.fr', 'Some describe me as enigmatic', 1,
'1503-07-01', '', '2007-01-06')
-insert into MemberAccount (accountid, username, enabled, accounttype, member_id) values
(1, 'user', 1, 1, null);
-insert into MemberAccount (accountid, username, enabled, accounttype, member_id) values
(2, 'admin', 1, 1, null);
-insert into MemberAccount (accountid, username, passwordhash, enabled, accounttype,
member_id) values (3, 'demo', 'ffd49efe97c77941fc149e1ab010fa8d', 1, 0,
1);
-insert into MemberAccount (accountid, username, passwordhash, enabled, accounttype,
member_id) values (4, 'duke', '97291c29cc69a65890424d0f97db28f2', 1, 0,
2);
-insert into MemberAccount (accountid, username, passwordhash, enabled, accounttype,
member_id) values (5, 'shadowman', 'd76acda33fcfede62a8a6979df88e690', 1,
0, 3);
-insert into MemberAccount (accountid, username, passwordhash, enabled, accounttype,
member_id) values (6, 'mona', '0a7adfe58071398e15b5177f4ace8493', 1, 0,
4);
+insert into MemberRole (roleid, name) values (1, 'user');
+insert into MemberRole (roleid, name) values (2, 'admin');
-insert into AccountMembership (accountid, memberof) values (2, 1);
-insert into AccountMembership (accountid, memberof) values (3, 2);
-insert into AccountMembership (accountid, memberof) values (4, 1);
-insert into AccountMembership (accountid, memberof) values (5, 1);
-insert into AccountMembership (accountid, memberof) values (6, 1);
+insert into MemberRoles (member_id, role_id) values (1, 2);
+insert into MemberRoles (member_id, role_id) values (2, 1);
+insert into MemberRoles (member_id, role_id) values (3, 1);
+insert into MemberRoles (member_id, role_id) values (4, 1);
insert into MemberImage (imageid, member_id, contentType, data) values (1, 1,
'image/png',
'89504E470D0A1A0A0000000D49484452000000AA000000990803000000884651B30000000467414D410000AFC837058AE90000001974455874536F6674776172650041646F626520496D616765526561647971C9653C00000300504C5445F6E555F5E664F8F9D8615D0B020101F3E433DAB920F7E874F8F8C8F8F270F7E984F8F4B8F8F398F8F3A0939218F2C903F8F8E8F8F380F8F4A8F8F168F8F390F8F378F1D615E9D368F8F388F8F160F8F4B05D5A45F7EA93F3F224F3D824F8F9D0F5E325F8F9B8F8F250F8F158E8C703E7E544FFFFFFF8F4C8F8F9C0F4E614DCCD2BF8F9B0E7E653F3F214F8F248E4C323F2DA33F0F100D2CB88E4C2137A782A808080E7E436B0AD6B8E894FF8F8A0EEDB7FF8F9A8E8E564A9A545E3D825F0D100E7D944F0F140D0CFC7E7DA342D2903A9A98BF6EAA3F8F998E5D516CCC9B0F8F140F0F148E3DA52B0AFA8E7D202E1C444CECE45DEC032F0EA00F0DA43908F73D4D16DE7E8D2F8FA90F0EA49F8F038E8E393F0E200F0F138EFDA00E7E300EEC913E6E424E3C856F8F4C0C1BC86FCFDF0F8EB00DDBD0AF8F988F0D209F0F108F8F100F4EAB236332AF0F050C2BE4CF2DB58FEFFFCF0EA40FDFEF7F0F2D8F8F4D0F0F280!
F8EA3EE6E6C6F8EB4CF8EB08F0F030F8E24AE5E4A2F8EF2EE8E575E8E6B3F0F078EFE249E7E984F0F088F8F108EFE13EF8F4D8474329F8F980F0F290F0EE70F0EE63F0F8E0F8E13EF0F2E0F0F268F0F2B0F0DA0AF8FA68F0F058F8FA58F0EB09F0F3B8F0F9C8F8FA50E7ED4595977AE7EAE2F8F8F0F8FA48F8FA401915019C9B52F8E208F8F978E5E917F8F970F0F3C8F8F938F2EBC596968EF8E200F0E109F0F098F0F2D0F0F2C0E7EE33E8EE54E8F185F0ECD5F0F8D8ECEE24E8EE71E8ED63F8DA00E8F2C2F0F2A0FBFAE7F8FA60F8D300F8DA0BF0F9E8F0F1E8F7FA29E8EEB3FCFEFDF0F858DAD8ACF0F0A8F8F3F0F8D30AF0F948F0F9C0F0ECE4E8EEA6ECCE23F0F9A8FCFAF0F0F9F0A3A06CF8FA00A09E91FBFEF70F0A09F8F8E0F8FCDFF8FCF0F8F8F8F9FCE8F8FCF8F8F4E0F8F4E8F0F890F0F8D0F0F898F0F888F0F570F0F878F0F868F0F560F0F8B8F0F800F0F8363E3D02E8F400F7FA11DDDF5EE8EED8DDDE37D9D9CB221F15F0F0F0BABBABDBDD94FDFDFEFEFEFFEBCC33F0FC50F0F8B0F0F8408D8D80908890FBFBF7F0F8A0B2AE1FB8BA3EEBCE46E9CD5BF068708C000027E94944415478DAD49D095C9357BAF04958B20BD9308440084B0904100A222188522DB160B16295A0288A2088524344CA52AC088892A2822B2D1AB54A5BD74ED599DA3A63B7D1DEB14E!
A7032FA66A6B97A9B4D63AB676C6B9DE56EF73CEFB2679134001BDF37DF380D4F90DEA
DFE73CFB5974F3F88F11378FB1FF2182501F19B6184D2693D168FF5FD4CF08B546A7D5EB73728AB1E468351AB5D25A68323EF2306484A888CFF69377DF05F0422BF3B30F05121977D54A46CAD4AB5341AE4E65AC6471157C915C4914D2FE62FF7E54879808B646FFE586231D6113C3C29A9A2636855132695222485898D9CC9588D444A1F1FF21AA11E993A999BDFA785458E2FCC308ACBCBC3CAD1C8BA1BCB2D2332868FE94D4D46BD7A6A6B0B8FC02E68318C383A19A98AA37571C3F82109BCA6B6B838343AAAADC9030B0B8B9D5D6D6B602B0E7A44993264E9CE86696E9ACA67F2BEA4DDBC26B0EACBC1A1576B8A6A6B2B20AF0C4623183C3E2B0A4F0813E59247055556D6B5313D0CE9F3495912CEA19A1218C08F5A79B9833C75C060669A8AA0AF1F313031A97C51272B9128944C1B50B8B858901B7B2B27246ECA4D4494DE6151AA6F1DF6800856AFD179B126B7263824342FC182C1697AB5028F8200A457AFA018140C0E74B2480AAA080198CDAFAFAAA5ACFA08829A991E606F908EC6044A8C6C202052BAA2331062954CCE1482124A58B2891CBE5A2741162C5023A9671855C16074CA11699AE2772B430337FD89A1D01AAB150CD179A37D5971BFCC034A552215771E04D20E4F1542A1E8F575050B075EB3F376EFCE8A38F1039202B24106F916E198C656ECB5A63E74!
7BC9C9AC850149C33FEDFA21A4FA8F52D9B320D864D7E2CAE502601752E91CB97204E159BADC45251111E1EAE561784871714F09600AE822F5120534866312028B4D6B64E9C7867991B4BC4040FBBF97F827A13DBE8AAE31D1DE586108654C6170844721E1081B0D96AB69249CA1AA5D2C15CC0E3C945D82014E90A6CB50CB765CB66CC884D9DB48C2BEA313D3254D8616AF584F68BB2C3873337B5B0C0D32165F2546AA4C9354CBAD840956C351680256905E948B7246DED8C496767DC59C6550F39740D0BD5C4E49B3B0E5F497B8F23E3233B0485224DF6D8C5091448552A20456650C05369343A64B9142CD8C18C198181917756EA08D3C3472DD473CC61619921EDB0F422B0CE82F08A8A35177A7C9010048199312A1B0B56EA871F6EDBB70F5B2ED832C0A60B8055C6C21E561B14E81B3929659DDAF49051C1F1A320B11BFC386B6507D2E54BC044D7ACB970E1A24F6767276665123D172ED050D978FD0FED43A805E8A7A0586406C02A447961597D6B5050606A64D46AA5E9A1A21AADFA6386CCE010B1542611E0A5672B7B488DFAD8967F0D928A0AA58D16FB1B5A7E64AD60AF28E4222380E02564B5B4B066B436C506A5A64EE4CA4D0F13D5AAFDAAACACCC0F481502E4F580C3ECA1833A504958C0A583CA4941A87ACCBA8AD5E2565F0F812035752A9777FBA1A19A880!
3C78E746CDAC041114A8E40C181887BA3B20743C56AE50A1B5829600448AF915393455
6E3C3412D545F3A1ED5F1DE06A91015F505C8EDC18FACCEA4242A4DA96CD7D5C7A4800A4D0DC08211AC34BBD53735C5A6463E9522B86F20180AAAD1AA5B71A4A3E3BDAF841250290F40C148AD202E4A6552A47663ED872AA250B5A83690281AB82D0C3082F249A99191299282DB0F8C5AA8D40A11E9DE6214F3514E420BDFDBDB6BA540095B4C2541696E5550E0B4FE544103AC5429038A45F5F724A860C008D4B7478E8ACDE77601D4A586CCCD400AEE04A068E13B9158298D1254F01F3A2A2E12157C015F281543E69AD11A943A2572E2E8825EE34851FF8A7EE5093E27AC3C66F3DEB5FC0F0A2A2AC048ADBD98F4CF7FFE3DA95382E8B1E57E27501BAA9D5423A2B1A6A32F9FCB567050290B790BB241E481AD85234535FD157EC85B0C31C17E1CA144C753123D84D5DADBDB498A8F5342453995F2A8F0704744A559AA4EA415690534D17E7E492694A2340B55ACAF6FEA538A7BF9D63D51DF353E62524ACC86603F944AE505CC1E2B22ED2503BF8FD519D49EFED934549E9D14D5005AAD0D351DA955FBF9BA7560AE52D06B6B6CA0EF94C8AB7CEB88DDCAA4BC6C2E8BF1E370D3C1A194E04E74549FFBA016B8A26A1DA8A4B97EFE395F815C0BAA9756CF4008B0A345A611A21A89CF8F676E0FE1C8043898621B75A0BA9232A970EA40E539913A50A966262707A280024CC00F!
B1C6064E99326D6541E1C8500BB5C73BCE6C6E17F2450515B0FA9491FA386BB51F29890A75AA13AA8E4445B07C3BAA04E22B4401B11F84AC26B081C83B50C08E04B550732CAAE31FED6BF9221E9B69EDFDF4D3F3E7FBA3320746553B506D4AB5A1EAED1D221299700F87034DA25B7D6B60E0D9C8A912A669F8A826CD97473ACE7CBD562B023B257A7B8114B362CC8BF0E14CEA28FF86804A61CA8A8BD7AE5D2B944A39805ADB1A783A3F726AFA8961A31A89B5656967DEFB82AFE1852BB1523F25512FDA954A76002E5D0A955081D5851422004AFF7ABD83548648D70A85528E991105A881F9F991A335A69BC34335296586BCCC903D393A35CA5088D4D5528983CB99C48DA7ADCB8937989F7DA83C148E528093EBDB8B5414F7C9565BE210A858B0484138E61670AD19B181F967A70D6CAE2EA8B429E809BDB83C2F582CD3AAD888944475B252623964AAE56397FECBBA7C16C1FC1D7B1B0D954EAAA132942BAA0C2A41076A8BD95C5F3BE3CED9D3F963B84AE370B46A524BABAA6242A41211C4536B67EF7984EAEC50D0A27CBFDEEAEF6179723D2896B90DAD3CDB29F4D3122A8EFB22CAF9158818969FAED5960DE67A68B9037DF3CFDE51140E03D548F01906684F8402502A9451E7B14B394729D0E9F7BFE97DD5C3E3FA2756EB412662C54EA576562A46B5E5285B9C225185!
5C072AB01A507005B54E5F166E1C3A6AA1A6C5501E02995F04E9B4B7F3FC00A8B0F8EB
ADEB7B6F747B78585EB52EFF1D53696BFD784EA436542D15FB257C72366403B5A38AABAA5A51703DBBE8E7D9D621A1E2BF1091B3292F4D2C940878EC1E1F1C5191F3BBE894580EA83F347B805EFFD5433C6B1B51A85C487524A9969A0FDA2C5528A4914AF77238E290AA4ACF58600D8DBC2BBF3954AD9A342D99B782A51201AA513ACFDBC2940395C0C204BD768205747B581E27BEFF0CA3AA5483A2920B5F5C2C9339BCDF8EBA97D3CEA8329437C59EF5CD8ABF33FBDCBD511D06625D77246DFB5B504EF12AD6F8748247F50E004A1C8418D0639DD50C26E0B1F409621F5E7E84AAA15B2AC45304AAD592594A02E9D449AB78F5F7022AC72F04A106FA9E0C8D1C5D601C22AAE658C78EF616BE08052AA84F7B517BE2E8A5AC881385FEEF97F780B93E761D6DD5F9FF406C53B20FA9551BD51A0D1A613AC5548C0A75BF40A7FBFC804E335BC05FB1B685868A45EC17526540E5A06FFC34857568A885FAE31DDBF7700572354A5314A8D54AD729CA51B3ACD6F5EB213CDC58EA6101D6279063A9792A15429593A80E52C8523A8540F3DCC25DEEEE4F3FFA9C40BF768F0B2966AD6D42AC6322193CE3506CD5A85C7524D30F2A3F2AFA53A4D61E1FBB43E1646AB53EF12F7FFFA5CDCD4B9109782CFD84493C7F48BD71A386522BADEFC3A80A9D6A61B3057DEFE4E65DDAE2142754B11!
86200781634DBB16721B6720B87826A151C2F7B4FCC47D5345DA9D61E6752A6F546B347B76DAF16C5AC170F32C3F16C0AB3DAFA3E448A52BF5EA05AD867FBFEC9BB246B6D2E8549DBC57B5B3688FDAA0C4DC8B3A6788DE699EE8F6A52AF8ACA7C4B2AE0152891A59E3F6F63B5A352F5D427CD24A203F769827988CD2351E5AEA85AD5A3FEF03DF817747B34CFCEA1A1EE1503EB1708B5CA505F0FCDCBA2E90AC2785F546B8EB9A36CAF4CA0C6CB0F71EA533AAA9DF48DE54BED94DD1EE49F7FFDE90AE5A18D83A00AE4FEB435983CB381A6544EBB582CDEB0C12F041CABBE2930B064D11846BAE9BE2940792C330D62AA4885961FA7A94FF180C26A5B7E8CFAC61BCB6F3C3E76AC7FF3D2A5D76D0016D0EB3EC85614AAC8195534CEE2615B06F8922492D1508154FCD5D780EA6730247AB695E47BDD492EBC1F6AA1EE481A38155FA76242A222532A0A5854870A0D3689BA7C790FB1E6D90B3DCFFEF0FE8D4F9EC6CC281724853FCF93BBA2625315F95BF0F253D22C90491DA60AEBDFBE01A1BA951912837CDB4AE2C72CB3DE07D5A8FE3271E75B29EB541BD9BFA172FFF997FED0D9EB3C9E224714E4FE4405DA9F40E5DFFBEF2FFC3829E9513519FA351AAA4A15680F48F412BDF651E733139647650E8DB68BFDDEF2030909090E8EF10456DFACD0E97264ACB707473569CD873!
3C45C81EA1D66EF1F9F1CEBFFDF8FA1A47AD1C74A9BF951ACB4490A359F60B3972C295
0DBEA7EB2A00254BD44B24EAF48EAB61B2A3282EE717CC7DA8B11E75B146AB96790EF94ACD0318ADBF460DF1FB5501F9597C69188366E63BEE4DF0D0BB6F4BF5F3ADFBBDE3EA07041653BA1AAD94A352FDD814A157F5A40D5CD6EF6A0A37A78EC9238A1BE6547455A9D9295356634714F0330122BA2766472243A35F3FB66D25FBA3FF93B425DDFD36FF0E318FB535DCA92251BE5F225B666CA3E4AD34AF47CCD8F931D8BDF8D8C364926759052CB0FA458ABF3DBB2B2F2A7390D30FAA1424DD59159265568D8C4275414F2587AA3F70FBD50E8F747653B76280A70E7A746DB82FD50F5395A81E8D16E3AAA0742E57058B4F547A448A931699E4141BE255953A63B652C57542364AA0E4388F0808AFD7DB3FDF77DF5BC0F0DD5D14DD348312ADEBE947F400E2828543ED47EEB24FA03CF7DDCED4CEAB14B46B75458FF90CD58A93195E541C8AFF2E397297F1A1CD5A46E88CA0C16E7BCA952FE61290E2DD7E1C7AB1721AA5EB82F2A9B6275460569E0F3D3D393BAE9B60A1FE3644EEB8F4849D48CBABAF96DBE2525F9D3C1026E0E865AA85915B6BD7D8FFE4D35D1EB6FFB9DBB5FEDF4B960754CA7075A7F357D3C4992EAC81695AFD737E8214A2775BB062B899352914B6D47A43119954128B296788F519C78E4A7818B40E32385FC948E1D66A156A37EE1A5276D79F3FA0FBDBF!
B15A8959F6413AE553D4184D5DE0984E3B2A3F11B5C58EAAE9755AFE6CDEC72EB63A79B69044F5F373B8542648466E651D1800425DA01CCC008C46AB24AA63BB58A6DB788838FF03558D788CEDEC5D0F4A25683AA58D7CD56A1AA8F38822DD860A05A06A5CB7073DB0762728A40ED210EC523131409A96919BEB191441A26A8C838E2CD4C223E5C110AAB6FE8EF8F4FC63FE285A5D1FFB52AF0FEAF409D7DD693AEA00D31434EDB5CDD1F407340BBB693E854C552FE5F4737E121569151940FE34BE69305493AAA5232D44C8D7B03F7B01FAD4C75E05D6B1FFE5034A454309D7996FB87D8E36E034C53E4995481AF4EB44B3FB3CE8163079E5658E1D35C4867A26332D2D23C3A6D5FC31B470E58A2A3703AA4CB0914D587FFFE7CE4FCF836B8DEDEDF4C1A8CB07402537FC074525C713EB7264FA063E0A01B46A25E1F217AEA83148AB69C800EA00D517A1D24A1617D442D1F1F2186855FEF40EA0F6BED489A280FFED4E88AA3D4C07AAD28EEA389BD07F9AE218FA026A4E8344B7D042AF6D77151F17F7473D93798B440D3A0916101A7F7770544154798C5826DAF8CE0BD6DF5B7B3B5F5A8A9CAA132AEBF54C82795F54B90BAA6DE893232B9649F4E9FE1647A44A98B9E78858DC0F35ED565A5A6E0642C52120F40E315804202451E5C162AE46B58FE85DFFFB3F747602AAFF7F!
5D5C7FA1A767CD9A81B627703A752695EB6C731FDB7C4A0F3D7FB1AC41F7BC9DD592F4
DCE77B8FB4D34971F08FB995762B2FB7AB0E0C00E500EF45D389412A2BA3461A66F0934A043CA50FDEA000AD7637775EB46FF75628D1076DBFDF354ED9767C1D864ACD7C4124FAD949166C00CDE366E748DBE9A465C16586B22AC38E8C6BE55D010101757511BE274F8256A7CF2E1C18D5A46B3718F0A4AAE2E21F51ED0FC9D563E9DFF17C9AD9D37FB7AFDF26FA12397D6BD23EF0C7A442D96A9DEE63F7C97DCDE366EA73F66C309BC56206AD9ECACC0C36245EC9CCCBEB3A551710D116B1DBBBC43B7ECC6C621054ED061A2AA8F5CF807A7D161D55790FD425B4982AE0F7475D9103BDA062365756BC67438AF96B3F3F86D856F993A83BF20E6F7FEBBDB08E989D01735F8B383D2CD44E94B01EB3A1BA287580FDFE7EA48EF5170A65C50DAB5F6F6890154B41A35FBF2536D3332A8A53E5897967A29E1A3F6AFCAFE53BE764854E98E0ED3D26793054BDD9100CA822848AFCFEEFFE605A4F5EA412AAE350C2885085B29C9CE215ABA47BDB916C3033C4CEA8699BD3366FDAD507E63CD93DF254D1DC880910589395F740E560D40B3844F9A0EA6AAC1DD599B4DF263A6D179DEFB2FE78E603A02BD6AEDD7315946A361F3773C47452404DDC7E6494858A6541D15959A0D6C151738E3BA1FAFC752C9AF10D865A30F07EBFC8D9A71CA82B5614AF5DB96AAD740F47CCE16CE0EC712!
8350685D4B4C4F66726E36102945DBFD4B59106A01E18B530078A95BD08957D01321441A0497FF7F53FFAF4B876A834D47B28D59954283DF6E5DA632D6BA5D216F39E3D624694935233D2D262362590C9ECBA47F7A8405F52ABAA9B03A34AA290ADF2452AE505E8FB5F207A6FA05FFB848F750D41ACA9703A3F45D57E05BC7E47135C94EA20FD0284C3C1CD3FADA2A20C1564B3D99DAA13BBBBDD2B8310EAA2C10CA03007A1CA6CA86F10D6C7E02F08C66A5DC37CC5D1A050658AEB26BAA69F52157452A1948351A986DA964EC9E507D0BCB49876777B89981014814280D7E8C1508BE9A804A0BE84FC6AE92CA8AB9EBD2FAAEEDE4A15DAE7A8B6D41F624FA819081582EA28AA96E9B68CAA8B980BB6EA957C5F5436B3A7877881B0F622BFF278D24A9AAA0D55ED5CA6D04614FD2CD5BE91669B4FB58BDB6D650A454AA2E6E5E55DD97EB58F6275CFDF3D670ED26A327B6054AB332A41BCD0F924EE587C888304731FFB5EA8BAFBA2E22FF6593AB0DA490115486B026EED49C0152D0A00738AE66254E5105081F48D177A1F5B8A2CE007E6B344B8D3094ADA569A9C36A2100D98FD49A50A855C210DD59651915233F230EAE1E360ACDD7D7DEEBF7846CF29CA220DC03860C7EA8ABADCFAC7BFE316FB45029DA01C16AAA41FAAD449A9B4E5B7A176EDFCD502A4BFA6469FFA6E5ED!
6DCD0FBDBAAD06E00CBAD3EC858BB3DFC6711FB680995DCF453F5DBEFA7D5540E5099C
3525903E8142BB52B2F1750E7678EEA8630B5FDD45FB2E71415CDDD8F51072D57A20C55212C8940C546136B1F6BCF85F54FE250F7E41B4CF63636B9874EDF4477EA509D399D35CAA119A9CDFD81B3AC0CBAA92B353575B9359E79354750A7386AFE3771A5D5BBDBDE4661D54B3118AA2EA5BE2A84211368D44AC2A7F3C21A6239F104CECACD2FA00DFF7BEFF7F727E5923BBE529683943EA3B0A1E676D5D4E482DCFA05FE2CCBAFDF2D2EADAEDE7D12A17A7BCD660ED605A4D45756892502CD87A0559F0BB3A0F59B454ED99E243EDBB6ED3EFBFDFD952AECB78BE692A71069DACE1D79E55D753535FF70873FA8AFE3BBC571D5D573E6BE0DA4F15EE983740146D52A84CAC55A257AAC6B7AD6302F8C2527F7DF13BFDB76BFFD7EBA47C964F45314F4E577CC28C8663AAD3CA63CA36BFED1C3C761FDBB471DFE76F1E2EA2D805AE20D5A5D621A0455DD10E659259609742A650F3AF6BB1CBCEB89A598F5C5EFF1D9847BECF76BFB8529E140A84E839F331919187547D7FC53B7C65BBA3D263F15306F0BC81C94AB42E3A729076B039592B044D02A5FAB41A86B7A7E032DB5F55FB8DCB9FE38B1EDDEFBFD5A814B392D1C54A9F6E47F2B63275454319E3BF3F2765C434E9570E5DBB82D5B22B26DA817066BAE99024065C80095D9A354327F83C67ED61F96E220D0FCECB67BEFF76B!
F9F753AA1329CEFEB73240D276D65C39BCE34C02DACFFCE55476292895445D94BF60B091C5BB26795462A59F50A2D754002AF12C5171F0E0724AAD1E370EDE7BBF5F3B408FD28FD451A66C870F841A9391D8752A60FEE6A7D0AE967B5D51766911851ABA68CC8241675646E5F144831B4B26D129994A2535A5B8F803B6D6EE66E521257B2B5BD56FBF5FE0DA4C0D86EA670B539BCAB0209F02D49A80E897CF5C45EE6FF9E5D4DCA2D2D2B8EC39A456BDB8E7061DB05B8F85190C52A14417CE24AFD18019ACB1BE4ACE449E561E52B3DF51FDA9FF7EBFE3A40FDF394B0D4C4A43455AED7AB9EB70C778F427B8474617815AE3905227784F58345D31E8D0F291C215516106B1542628A86023ADA21685C99CE58F4BB3EB8F33F7A9D9E86882EB7EFF1050D1869FDDF9112612849A917BF4D4D133BFF6A1DAEF97AE39A5A573E200B50D85AAF805A2C150DF859E1550191C9980C7B6A32A0F128F918DE4D227986C363AF0E1B2DF6F23D5BBD653B4FD7EA7804AA1A691A8353B3B9E72C74A4D3C95F597D2ECB8ECEC3925DE60AB5E33D5C641518D9A63D7CA21B5F2D1D95A1BEA67C4F7FF229B9EE66789F7B7F6DFEFA750F5FA7EEE6F476DA7B44A7A14897A2B0F0F5373CB83CD09B84C1DD5B53FBBB4B4318EF47FEF45D3934F18073DBB6254AF0A4B0CF6E3F245BCF00A8C0A617F!
DFC183B3A8ED16FFF795CA77FAA1F29D510720E5D09C1F82D47B58A757F26EA5E5E6D6
E56E372775A3D32F7DA9A7E635966683905175D1F425B7073F666324D685251A5C50C15CDFB871DD8237FCFD9F2D50F5DBEF1F022AA9555B3C2D3B83945A73250F4A9580DC1990A6D07992512F37663716656FF9761EA9D5F83BCCC17603FF4A0E83AF5586B014E8CC32690088F533E6F21BD4B983E647953CD7F57718C000962A75DA9DA6AA54A4D4BC2B355772EBEAEA70958AAABF2B718D8D73B2E31AE7D9A2EAE87337EF81FA88F58B6B95552C2E57AF2A40EA64E20B54E115AF54DCB0ED373C7E88ADFA001DF1D46A6DA7A7052EC31419AD45B5E77EDCABFA859405076F37844134ED4283F4A35DD77EE9C6EDB47B4744517563E3E2B8B83973779F0C0D9DB0689ADC742FAD3E6292D47B5631582C894E85EF50E2CB5EE1F0F1AC6D77F0FAC2E7D550F78B04DAFFA150F92E3D0AAA53B9745452A5246A704C624CB0A132F768DDCEBA9D5DF337FF6AC12EDB9778AAA8A8A871F162E45427013574D102A773AC4EA8EF6283D531122BDD185C894883D50AA8AF6054E513B65DF2EB8F2B79CF69340211757A9A3FE0DCC7D19F501E45C6AAE098AA8CEDDBD1156C58FBA0EDEDA3F0EF0A3D6A576351512990C66517CD3D791A50A727171AEF7D2044299BD80A6A55E06B75CA0A506AB8F295F0F043CA7D8FDBCED3343FAE66FFE947DB496FFD40633F29CDF9DBC5E8580238D46!
6726FA232A3B2127554B9A906BF51D73D4897EACA8E2B2A8D03C9CE7E0D525556E8A2694B4CF73B66239AEA09D6AAC0D7D5C84329EC2505EC258794C48BD7A9CD9CEB4FEF63BFF3276CAEF8983712011D554AEBFB40A9B48309C05AEE990B71DFB3BCEAADA9EEDDE4886A54EE965288FD24EAEEB9732740A4BACBBCFFE125565379157A8542CE2359C3D95BD5EC021E7BDB672F4EB66DE6FBBFBF4DFD4F0A55824ECFF2D3F9039372C4B6FD8990CD642FBD236367578D674670D4332429E834F5BB6C52A738A962FF9FA6B87DF37E47C2CE290C89E5E81ABD6809C91ACE2E50ABE1F37925662565E98BDB3692A8F8902779D54BD67FF9D1C1349BF891B3B40CE8FBF2B66F9E3ADEE281775C2CEE8721F6CF2BA248E7B4B54DC85AE4759777FFD36B461123D153CCE24A04F8B62AB47D6CF5C68D3CD556F53B6AE5E38EF35FFE7F83D0AAC517FD30EC8001152B959A5231C4D854336EEDDC79F8BDF667126C5B83EE5DA7B2B38BFED248A1CE2D393D21347EFAA3177FBA2FEA4D421616E6C60213A02E7FA3B60F55D4D0556DDDBAD07EB0C76372D2F36ACDEC035ABD449693236B28465712D0F509A74405A0B0F666B319E22AA3AA2A66C78E1DB7B6771CF962BC6D77D8D2D711BDB8148AD438ECFEB8A89A10EAE5E254839CB4348952A0BC02B5F2D12DE0021B2A16F5D68563BB6!
DBBBA16FF8FDF57A974073ED7E75C5EBDA2780516A1935ED1618F4D9B4220526DDA54E
F161C53595E6ED8F4F5D55F132C944E2DEE8947B7141551A8403AE7644949FE22AFE4577EBA3984F3AB4C4954981B34030A60E5915D3FC2E4A9E41FA8C064C7D1CE2D2E4D58A8D668D75DCEC9293E06BA85FF38400115A914BCA92CB32C78F3E6ED19B9199BDBF7AEBA9AD0673B6CD4DDF7CBCE80C510FBC150BF2151E79684FAC67B2D4877BD1E32F0B170936EE5D47A37066245AE85DB7E40DD28177DF08146B595FDB8EDFC05F6AF8485CF6974EB5E7FFDF5D50D4880942BC5AF8490C3A9CD219BB16C3264A4C56CDE9BF24C529F635BD87DEACE79DF940269751CD22AAEA930EA6C6248A782A1BE6AA80FABAA02D7C2B79679142ACAA650546DE46D7C22C1E2413B0EDAFCF18F1FE9F49FA391FAEA06590E6D8E4A4EFCCAA2A2369919511D6FED59F98CFB64C7B94CCBA8A853D18DB0F8800A76BA05934E28F106A5F6BF863DD8617B514A13AE0470C42251FF864FFBA291BFE639D52B9FF4398EA2200FF31FF79CE64D11A4AF75DCD5A05564A5B6911F8AFFE23D6B8552E1CC517D16C7AFB2B83F95990A9AC42E1517575ABA259B5653DF1C22AAB182D5E4099500A0A653A8BCBF913D152AFB342AF99227F02E343964463F2CCDFEE316FE28D069F539E85C2AA7BDBD9D3AEC09159554C89D397E57DF640BED4C605F42C7D1E8EFD0781207A9D2A2EA2DA8510D0D05D4690A!
D3D02F8648A6267A5621567425186BF543D50768F9E53A0D3A412357172C6CB67878381D9EB2F425248D7B7436BEA92E5C4B4D2C64B28699E313DC275BBA699CDD1E7DBFFEE3E5EFBE9907E9F43BF0288C5A847CCA1B0A15AFBB153787AA55C8AE978FA456B62E63488B256FE2774A541F6EA56A69F22AA248B4759B937BD9B69C2C93FDFD1392767D3C7EDCC7E3762525F9BB374FB6D0BF8D3C6435EADAAD97179399F41BFC01CE3F6F7F1B74D4D0FDDFAD18CE25A6C28F8E5F4B6CAD65985735E8D1F31A1A95FA6F24AAFD82E79B1B55EF274D763A9166B3876EDAF96B5B58A27D575F4264C7A9E86FE34A31E8B7DFD882FFDC9212DC52259FBF399CFB56CAD7AF4E0AAA724B61ADC8811A4B839EA2A06B15E5FC033A8DEAC78F9B9DF4752F21FF2296C9A39E0AFE47CDCB5B1A17DB504170F047738AD078AFD1E9A6615DB82BFCE78A899E9EF528C1CAA01AE09177289CBA29EDA5D5AB3FD2FD38CE7DB26520B0817EDE3DD97D7C7D484C5740F4962D8D5B16236DE2E5C7B39F93132640F107D17FCDCD61A11AAD1A46FDA449F50CD64A21BAC62CD7E944F67713C80665B55EABBFA4D7EA3E9ABD30C9DF39780D483EB92F61FC5351C13BEA8EBE1CDD185D3D07A12EC63E1557BA65FFFEB6D3135045B52079E0E783EE7539D4AA654C9C545FC55886328168097ABAC63E4FC3!
A850553534404A6DC8D1EBB43F8EDBD5D76719D00E502C85E0307E668ADFD765693501
01D18D8D1173AAA31793A8A89C2A02D292B74FA38A7A36F3E6F0AFDC5A0529133D5B6B97A14C802EC98B68CF51E02B7E02AD645D31AA52D616E7E45C7AF37F9E5B382EC1BDCF6271BA8161B1F4B98FFAF5AAF9EB4DDB77EC4CCBCB3BD5151111702A7A4B3519A470DD9FFDDA7EBCFDEF1D3F6D80EB4B43B9C8CCE44E9D14DB8A330148BAB356C96A5A9253BCEACB55202B5614E75CBA7CE9D281D9AB1F1D377E57524242425252D2AE5DE366CE5C756CC386E0CC5B69878F8246038E469C8A8EA86EACDEDD8851172FAECE2E7AEDB5B9E49062FA82F4774774E7FA26A19878D613B1E2B7B504A27411FE24515D36A685C2155FAEFA72C59797E1F3F20AD9E575AF7F79ECABAFBEFCEA8BAFCCE64D86AACCAAF25B57AED45C01D8E8882D5BB62CAE2649B75457BFF6DA9CB9AFFD7642E8E9455EA3E5E7467AE9BE8035313608589162F9E9F88227A555DA7CC23EF6E170BEE0D0C614EF6141CD5F157ED0EC56DE953C8C6AB351845A1D510D6D1FEE51A19F1A30A20EEDD98DDBF2959352A11A80EA15BDB5C417902768495474C7CF7679166DFCD04769A84C316FB29D4BCDC05D7F571AD66A7434E54CDF9496562352B4FA592469C503BC10522858762D28A8B2CA6D192A5F25E8CE9CC0F9EA240857662F52ED4728ECBB1308B5B2120DA772F36A6C4AC52A2D2D6DACAEDE1D81953!
A370BDAA99482DB37478E7A93A9989A3A29A8B516B10A65946629535DE7B83B0D0AB5F77EF6A16FB05B885B485515B9FC9575E8B41FA9D4C5B662AA7AF7EEDD27116A567CFCF499A2113FBB811F0633A9210C04C67AD6BA315A56715743630036ABA050D7AD73907238B6D6DF861A5C85AD34A40A0F547273EB024E1D8D8E8EFE962A53E2A0F8DFBDFBB7BFFD2D4A52F15E91CFA4171A1F0015BD0A58C15D163B05C52CC64A564B03F9C61E46BD74E9D2E5CBC532C7C01F38F7D2B6FCF0F1296AC31F16BF068C20C066A7C8A18A204861D2ACD04563EEDCE5163EF8C33B4AC9B249939A5AEBDD520056C85550A439924BE45304F6A68FBE3F05B818358624A550A3031A4BFF42AE7E7575F61C207DFBEDB7A198F29A962C62FEF4E0CF19190BE5C91353DB82EA97A1A8C5422F150269710E5E7B8C483B432166D8372882494C24680FBDAEE6E8D1E8C5A0D6461034469F370FA5A8B7BD4F43D7AFB8EFBB81437C24AA50B47262EA7CCFDADA5AE45CC08AA613329A99726CDECF4143143F3B6AA61D14A3824F21CE4628F8A1E8DBDF968548BD17C5DF492E78488F44A13BF8AC89918181ADAD6E5011AC6A20071332050EFFF695670DB0897E2B8D3C928E04152A688E829AE93920BB21F0A3419AD70285AAF0A1BD12662244C9137FCE0F84A01595D2D202391F2D790399AAA4F65!
B73039CF3BF959647911E4581EA5B0C5A04A914652844EAE5355AC11CC2137C4345359
A4EF01477CE9E4D8DADF49CE8C64861B500D4AA55A8C973A855ECBCE3439E9F855A2AB70640036A0290A19275D46B18D4DB1B55D2D3466B86F456E0305EB433128A657722A704050595A358C0309BCDA05D21582B8B0AAA78EC43230D8ED991792B039306D405603B8DC3BB52A0D2096F232B8596EFA995835728237E27D0D823624D4D9DD2B63B088A58B77A831BB0B6403CA0C23F57BA971C4F23D4EDC1F6235428F423D080886A88A4E04CFBDBDADA26204E6FC85077930B86F8FEE2B05E5F3416AAB85323A7F80605C6B6B6D6D6BBB99951ECA22629A055A7AB3358A924298AFC50F94557431EDD8F494B266052AF6977D395437D8975786F5A1A0B0901EBCECF67037D03CFC6B656CDA8A71E0506BE0DE20DF42A2538B88CD429891A5117111D1101E9BE0DFBD28409A731E9DD64F98921BF193BDC474D8D850502EE8C9FCF9E0D0C8A8D8D6D6D025A904DA4F8F931EC5B93E4A9340A3428222202D40984BF7D1BA551EFFCF8F8313FDF495E123E8C375847F054AC8948E7DEFD79CCD97CDFA0A0D8C0D8D87A30857A039210A0260B29AA9ACAADACF304370CDA1FB1BF6DFFDCB9E8A0375AF9D0F8455ED31770353DB787F376F4881EE035F5A48F5E30E6AC2F4850906713487D7D3DFAEA568B9E87AEA58ABECA204F0C1A848CB30D8AE7B92429ACFCF405C94BD6986E0EEB!
4F1D012A1A7C99948A94896723A74C99E21B084ED6143BA3A9B515CCA1094B6BAB67ABA727E284FFF364D0C9365FF02310D02A9A9D7A81DBA7FBDC1EAE8246FA02B389D0485853EF449E9D9235657F6020D8019619E47F3C01117D0682DE03DBD075A41274140502FEA2F8E977C09946F2C8F9033C176F62A673199013B2E6B6B5F90622390B9481A4A406228DFB96A00F2490404371F33C2D39BDC20426FAEEBBFF3E54FC2EA388CB98181939E5EC94FCFCD3F9A70116A218522510624892131D43098D8F8FC72B5F31D257E31FF0B97853A1559D9E7C17426D7EBE777E49BE6F7E49C9695FEF7CEF126FF8249D088750707908F7AF3CC87BF10FE1117E9355FD918CB5ECCECF6320DC8EC91F939F0FCCDEF0351FAB1294E935E6CE32165FAE3CF7D3833CC3FF30FEBD00A3D174EE62F82BE9E977172C98366DFAF4E963904090F79A3E7DDAB405A3472BD2D544E103FFEB060F03D5BE31C756C9450A8542865E0246CFC44BF8682F8938E14849C6FF4F508DF85F3A28F4F139015278EEDCB91327CEB9E8F28151FF73FEC590FF18F95F0106009BB82CA79ADF6F600000000049454E44AE426082');
Deleted:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/AuthenticationEvents.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/AuthenticationEvents.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/AuthenticationEvents.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -1,19 +0,0 @@
-package org.jboss.seam.example.seamspace;
-
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
-import org.jboss.seam.contexts.Contexts;
-import org.jboss.seam.security.Identity;
-import org.jboss.seam.security.RuleBasedIdentity;
-import org.jboss.seam.security.management.JpaIdentityStore;
-
-@Name("authenticationEvents")
-public class AuthenticationEvents
-{
- @Observer(JpaIdentityStore.EVENT_ACCOUNT_AUTHENTICATED)
- public void loginSuccessful(MemberAccount account)
- {
- Contexts.getSessionContext().set("authenticatedMember",
account.getMember());
- ((RuleBasedIdentity)
Identity.instance()).getSecurityContext().insert(account.getMember());
- }
-}
Added:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Authenticator.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Authenticator.java
(rev 0)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Authenticator.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -0,0 +1,70 @@
+package org.jboss.seam.example.seamspace;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.contexts.Contexts;
+import org.jboss.seam.security.Identity;
+
+/**
+ * Authenticator bean - authenticates the user against the database
+ *
+ * @author Shane Bryzak
+ */
+@Name("authenticator")
+public class Authenticator
+{
+ @In
+ private EntityManager entityManager;
+
+ @In
+ private Identity identity;
+
+ public boolean authenticate()
+ {
+ try
+ {
+ Member member = (Member) entityManager.createQuery(
+ "from Member where username = :username")
+ .setParameter("username", identity.getUsername())
+ .getSingleResult();
+
+ if ( !compareHash( member.getHashedPassword(), identity.getPassword() ) )
+ {
+ return false;
+ }
+
+ Contexts.getSessionContext().set("authenticatedMember", member);
+
+ for ( MemberRole mr : member.getRoles() )
+ {
+ identity.addRole(mr.getName());
+ }
+
+ return true;
+ }
+ catch (NoResultException ex)
+ {
+ return false;
+ }
+ }
+
+ private boolean compareHash(String hash, String password)
+ {
+ if (hash == null || password == null)
+ {
+ return false;
+ }
+
+ String newHash = Hash.instance().hash(password);
+ if (newHash == null)
+ {
+ return false;
+ }
+
+ return hash.equalsIgnoreCase(newHash);
+ }
+
+}
Modified:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Member.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Member.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/Member.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -11,6 +11,8 @@
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
+import javax.persistence.JoinTable;
+import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
@@ -56,6 +58,9 @@
};
private Integer memberId;
+ private String username;
+
+ private String hashedPassword;
private String memberName;
private String firstName;
private String lastName;
@@ -68,6 +73,7 @@
private String location;
private Date memberSince;
+ private Set<MemberRole> roles;
private Set<MemberImage> images;
private Set<MemberFriend> friends;
@@ -81,6 +87,29 @@
{
this.memberId = memberId;
}
+
+ @NotNull
+ @Length(min = 4, max = 20)
+ public String getUsername()
+ {
+ return username;
+ }
+
+ public void setUsername(String username)
+ {
+ this.username = username;
+ }
+
+ @NotNull
+ public String getHashedPassword()
+ {
+ return hashedPassword;
+ }
+
+ public void setHashedPassword(String hashedPassword)
+ {
+ this.hashedPassword = hashedPassword;
+ }
@NotNull
@Length(min = 3, max = 40)
@@ -133,6 +162,18 @@
this.email = email;
}
+ @ManyToMany
+ @JoinTable(name = "MemberRoles", joinColumns = @JoinColumn(name =
"MEMBER_ID"), inverseJoinColumns = @JoinColumn(name = "ROLE_ID"))
+ public Set<MemberRole> getRoles()
+ {
+ return roles;
+ }
+
+ public void setRoles(Set<MemberRole> roles)
+ {
+ this.roles = roles;
+ }
+
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PICTURE_ID")
public MemberImage getPicture()
@@ -238,4 +279,4 @@
int age = ny - by + (nm > bm || (nm == bm && nd >= bd) ? 0 : -1);
return String.format("%d years old", age);
}
-}
+}
\ No newline at end of file
Deleted:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberAccount.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberAccount.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberAccount.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -1,122 +0,0 @@
-package org.jboss.seam.example.seamspace;
-
-import java.io.Serializable;
-import java.util.Set;
-
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.JoinColumn;
-import javax.persistence.JoinTable;
-import javax.persistence.ManyToMany;
-import javax.persistence.OneToOne;
-import javax.persistence.Table;
-import javax.persistence.UniqueConstraint;
-
-import org.hibernate.validator.NotNull;
-import org.jboss.seam.security.management.UserAccount;
-
-@Entity
-@Table(uniqueConstraints = @UniqueConstraint(columnNames = "username"))
-public class MemberAccount extends UserAccount implements Serializable
-{
- private static final long serialVersionUID = 6368734442192368866L;
-
- private Integer accountId;
- private String username;
- private String passwordHash;
- private boolean enabled;
- private AccountType accountType;
- private Set<UserAccount> memberships;
- private Member member;
-
- @Id @GeneratedValue
- public Integer getAccountId()
- {
- return accountId;
- }
-
- public void setAccountId(Integer accountId)
- {
- this.accountId = accountId;
- }
-
- @NotNull
- @Override
- public String getUsername()
- {
- return username;
- }
-
- @Override
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- @Override
- public String getPasswordHash()
- {
- return passwordHash;
- }
-
- @Override
- public void setPasswordHash(String passwordHash)
- {
- this.passwordHash = passwordHash;
- }
-
- @Override
- public AccountType getAccountType()
- {
- return accountType;
- }
-
- @Override
- public void setAccountType(AccountType accountType)
- {
- this.accountType = accountType;
- }
-
- @Override
- public boolean isEnabled()
- {
- return enabled;
- }
-
-
- @Override
- public void setEnabled(boolean enabled)
- {
- this.enabled = enabled;
- }
-
- @ManyToMany(targetEntity = MemberAccount.class)
- @JoinTable(name = "AccountMembership",
- joinColumns = @JoinColumn(name = "AccountId"),
- inverseJoinColumns = @JoinColumn(name = "MemberOf")
- )
- @Override
- public Set<UserAccount> getMemberships()
- {
- return memberships;
- }
-
- @Override
- public void setMemberships(Set<UserAccount> memberships)
- {
- this.memberships = memberships;
- }
-
- @OneToOne
- @JoinColumn(name = "MEMBER_ID")
- public Member getMember()
- {
- return member;
- }
-
- public void setMember(Member member)
- {
- this.member = member;
- }
-}
Added:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberRole.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberRole.java
(rev 0)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/MemberRole.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -0,0 +1,44 @@
+package org.jboss.seam.example.seamspace;
+
+import java.io.Serializable;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+
+import org.jboss.seam.annotations.Name;
+
+/**
+ * Represents a security role.
+ *
+ * @author Shane Bryzak
+ */
+@Entity
+@Name("memberRole")
+public class MemberRole implements Serializable
+{
+ private static final long serialVersionUID = 9177366120789064801L;
+
+ private Integer roleId;
+
+ private String name;
+
+ @Id
+ public Integer getRoleId()
+ {
+ return roleId;
+ }
+
+ public void setRoleId(Integer roleId)
+ {
+ this.roleId = roleId;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+}
Modified:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/RegisterAction.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -3,8 +3,10 @@
import static org.jboss.seam.ScopeType.CONVERSATION;
import java.util.Date;
+import java.util.HashSet;
import javax.ejb.Remove;
+import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import org.jboss.seam.annotations.Begin;
@@ -13,14 +15,10 @@
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Observer;
import org.jboss.seam.annotations.Out;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.security.Identity;
-import org.jboss.seam.security.RunAsOperation;
-import org.jboss.seam.security.management.IdentityManager;
-import org.jboss.seam.security.management.JpaIdentityStore;
@Scope(CONVERSATION)
@Name("register")
@@ -34,19 +32,12 @@
@In
private Identity identity;
-
- @In
- private IdentityManager identityManager;
-
- private MemberAccount newAccount;
-
- private String username;
-
+
/**
* Password confirmation
*/
private String password;
- private String confirm;
+ private String confirm;
private String gender;
@@ -70,53 +61,27 @@
if (!verified)
{
FacesMessages.instance().addToControl("confirmPassword",
"Passwords do not match");
- }
- }
-
- @Observer(JpaIdentityStore.EVENT_ACCOUNT_CREATED)
- public void accountCreated(MemberAccount account)
- {
- // The user *may* have been created from the user manager screen. In that
- // case, create a dummy Member record just for the purpose of demonstrating the
- // identity management API
- if (newMember == null)
- {
- newMember = new Member();
- newMember.setMemberName(account.getUsername());
- newMember.setGender(Member.Gender.male);
- newMember.setFirstName("John");
- newMember.setLastName("Doe");
- newMember.setEmail(account.getUsername() + "(a)nowhere.com");
- newMember.setDob(new Date());
- newMember.setMemberSince(new Date());
- entityManager.persist(newMember);
}
-
- account.setMember(newMember);
- this.newAccount = account;
+
+ newMember.setHashedPassword(Hash.instance().hash(password));
+
}
@End
public void uploadPicture()
- {
- newMember.setMemberSince(new Date());
- entityManager.persist(newMember);
+ {
+ newMember.setMemberSince(new Date());
+ newMember.setRoles(new HashSet<MemberRole>());
- new RunAsOperation() {
- @Override
- public String[] getRoles() {
- return new String[] { "admin" };
- }
-
- public void execute() {
- identityManager.createAccount(username, password);
- identityManager.grantRole(username, "user");
- }
- }.run();
-
- newAccount.setMember(newMember);
- newAccount = entityManager.merge(newAccount);
+ MemberRole userRole = (MemberRole) entityManager.createQuery(
+ "from MemberRole where name = 'user'")
+ .getSingleResult();
+
+ newMember.getRoles().add(userRole);
+
+ entityManager.persist(newMember);
+
if (picture != null && picture.length > 0)
{
MemberImage img = new MemberImage();
@@ -130,21 +95,11 @@
}
// Login the user
- identity.setUsername(username);
+ identity.setUsername(newMember.getUsername());
identity.setPassword(password);
identity.login();
}
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername(String username)
- {
- this.username = username;
- }
-
+
public String getPassword()
{
return password;
@@ -202,4 +157,4 @@
@Destroy @Remove
public void destroy() {}
-}
+}
\ No newline at end of file
Deleted:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserAction.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserAction.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserAction.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -1,172 +0,0 @@
-package org.jboss.seam.example.seamspace;
-
-import static org.jboss.seam.ScopeType.CONVERSATION;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.seam.annotations.Begin;
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.core.Conversation;
-import org.jboss.seam.faces.FacesMessages;
-import org.jboss.seam.security.management.IdentityManager;
-
-@Name("userAction")
-@Scope(CONVERSATION)
-public class UserAction
-{
- private String username;
- private String password;
- private String confirm;
- private List<String> roles;
- private boolean enabled;
-
- @In IdentityManager identityManager;
-
- @Begin
- public void createUser()
- {
- roles = new ArrayList<String>();
- }
-
- @Begin
- public void editUser(String username)
- {
- this.username = username;
- roles = identityManager.getGrantedRoles(username);
- enabled = identityManager.isEnabled(username);
- }
-
- public String save()
- {
- if (identityManager.accountExists(username))
- {
- return saveExistingUser();
- }
- else
- {
- return saveNewUser();
- }
- }
-
- private String saveNewUser()
- {
- if (!password.equals(confirm))
- {
- FacesMessages.instance().addToControl("password", "Passwords do
not match");
- return "failure";
- }
-
- boolean success = identityManager.createAccount(username, password);
-
- if (success)
- {
- for (String role : roles)
- {
- identityManager.grantRole(username, role);
- }
-
- if (!enabled)
- {
- identityManager.disableAccount(username);
- }
-
- Conversation.instance().end();
- }
-
- return "success";
- }
-
- private String saveExistingUser()
- {
- // Check if a new password has been entered
- if (password != null && !"".equals(password))
- {
- if (!password.equals(confirm))
- {
- FacesMessages.instance().addToControl("password", "Passwords
do not match");
- return "failure";
- }
- else
- {
- identityManager.changePassword(username, password);
- }
- }
-
- List<String> grantedRoles = identityManager.getGrantedRoles(username);
-
- for (String role : grantedRoles)
- {
- if (!roles.contains(role)) identityManager.revokeRole(username, role);
- }
-
- for (String role : roles)
- {
- if (!grantedRoles.contains(role)) identityManager.grantRole(username, role);
- }
-
- if (enabled)
- {
- identityManager.enableAccount(username);
- }
- else
- {
- identityManager.disableAccount(username);
- }
-
- Conversation.instance().end();
- return "success";
- }
-
- public String getUsername()
- {
- return username;
- }
-
- public void setUsername(String username)
- {
- this.username = username;
- }
-
- public String getPassword()
- {
- return password;
- }
-
- public void setPassword(String password)
- {
- this.password = password;
- }
-
- public String getConfirm()
- {
- return confirm;
- }
-
- public void setConfirm(String confirm)
- {
- this.confirm = confirm;
- }
-
- public List<String> getRoles()
- {
- return roles;
- }
-
- public void setRoles(List<String> roles)
- {
- this.roles = roles;
- }
-
- public boolean isEnabled()
- {
- return enabled;
- }
-
- public void setEnabled(boolean enabled)
- {
- this.enabled = enabled;
- }
-}
Deleted:
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserSearch.java
===================================================================
---
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserSearch.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/examples/seamspace/src/org/jboss/seam/example/seamspace/UserSearch.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -1,51 +0,0 @@
-package org.jboss.seam.example.seamspace;
-
-import static org.jboss.seam.ScopeType.SESSION;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.jboss.seam.annotations.In;
-import org.jboss.seam.annotations.Name;
-import org.jboss.seam.annotations.Scope;
-import org.jboss.seam.annotations.datamodel.DataModel;
-import org.jboss.seam.annotations.datamodel.DataModelSelection;
-import org.jboss.seam.security.management.IdentityManager;
-
-@Name("userSearch")
-@Scope(SESSION)
-public class UserSearch implements Serializable
-{
- private static final long serialVersionUID = 8592034786339372510L;
-
- @DataModel
- List<String> users;
-
- @DataModelSelection
- String selectedUser;
-
- @In IdentityManager identityManager;
-
- public void loadUsers()
- {
- users = identityManager.listUsers();
- }
-
- public String getUserRoles(String username)
- {
- List<String> roles = identityManager.getGrantedRoles(username);
- StringBuilder sb = new StringBuilder();
-
- for (String role : roles)
- {
- sb.append((sb.length() > 0 ? ", " : "") + role);
- }
-
- return sb.toString();
- }
-
- public String getSelectedUser()
- {
- return selectedUser;
- }
-}
\ No newline at end of file
Deleted: branches/Seam_2_0/src/main/org/jboss/seam/identity-management-2.0.xsd
===================================================================
--- branches/Seam_2_0/src/main/org/jboss/seam/identity-management-2.0.xsd 2008-04-03
21:36:37 UTC (rev 7813)
+++ branches/Seam_2_0/src/main/org/jboss/seam/identity-management-2.0.xsd 2008-04-04
02:08:22 UTC (rev 7814)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
-
targetNamespace="http://jboss.com/products/seam/security/management&...
xmlns:identity-management="http://jboss.com/products/seam/security/m...
-
xmlns:components="http://jboss.com/products/seam/components"
attributeFormDefault="unqualified">
- <xs:import
namespace="http://jboss.com/products/seam/components"
schemaLocation="components-2.0.xsd"/>
-
- <xs:element name="jpa-identity-store">
- <xs:complexType mixed="true">
- <xs:attributeGroup ref="components:attlist.component"/>
- <xs:attributeGroup
ref="security:attlist.jpa-identity-store"/>
- </xs:complexType>
- </xs:element>
-
- <xs:attributeGroup name="attlist.jpa-identity-store">
- <xs:attribute name="account-class" />
- </xs:attributeGroup>
-
-</xs:schema>
Modified: branches/Seam_2_0/src/main/org/jboss/seam/security/jaas/SeamLoginModule.java
===================================================================
---
branches/Seam_2_0/src/main/org/jboss/seam/security/jaas/SeamLoginModule.java 2008-04-03
21:36:37 UTC (rev 7813)
+++
branches/Seam_2_0/src/main/org/jboss/seam/security/jaas/SeamLoginModule.java 2008-04-04
02:08:22 UTC (rev 7814)
@@ -115,40 +115,9 @@
}
}
- // Otherwise if identity management is enabled, use it.
- IdentityManager identityManager = IdentityManager.instance();
- if (identityManager != null && identityManager.getIdentityStore() != null)
- {
- Identity identity = Identity.instance();
-
- try
- {
- boolean success = identityManager.authenticate(username,
identity.getPassword());
-
- if (success)
- {
- for (String role : identityManager.getImpliedRoles(username))
- {
- identity.addRole(role);
- }
- }
-
- return success;
- }
- catch (Exception ex)
- {
- log.error("Error invoking login method", ex);
- LoginException le = new LoginException(ex.getMessage());
- le.initCause(ex);
- throw le;
- }
- }
- else
- {
- log.error("No authentication method defined - " +
- "please define authenticate-method for <security:identity/> in
components.xml");
- throw new LoginException("No authentication method defined");
- }
+ log.error("No authentication method defined - " +
+ "please define authenticate-method for <security:identity/> in
components.xml");
+ throw new LoginException("No authentication method defined");
}