-
1. Re: Using Name, Surname Attributes in Seam Security 3
lightguard Dec 9, 2011 10:43 AM (in response to benan.aktas)Those would be extra attributes for the identity, if you want to stay in the same structure as is being used in the IDM example.
-
2. Re: Using Name, Surname Attributes in Seam Security 3
benan.aktas Dec 9, 2011 12:51 PM (in response to benan.aktas)Hi Jason
Thank you for reply.
I mean that, for example I want to add an attribute named firstname, and i want to see it in database. So at first i must know in which table I should add a column and relate to our security system.
IdentityObjectAttribute or IdentityObject ?
-
3. Re: Using Name, Surname Attributes in Seam Security 3
lightguard Dec 9, 2011 2:28 PM (in response to benan.aktas)Either will work really, I guess it depends on how you want to access it. If you're going to be using pure picketlink APIs then go with IdentityObjectAttribute, if you want to access it via JPA put it on IdentityObject. The attribute way though works like a key value table, IIRC. So it's really just another row in the table, not a separate column.
-
4. Re: Using Name, Surname Attributes in Seam Security 3
benan.aktas Dec 9, 2011 2:38 PM (in response to benan.aktas)Thanks.So ,
At first
I am adding
@IdentityProperty(PropertyType.NAME)
private String firstName;to the IdentityObject class.
So I should create an Authenticator class. ?
Can you give me a more detailed example ?
-
5. Re: Using Name, Surname Attributes in Seam Security 3
lightguard Dec 9, 2011 5:13 PM (in response to benan.aktas)
Benan Aktaş wrote on Dec 09, 2011 14:38:
Thanks.So ,
At first
I am adding
@IdentityProperty(PropertyType.NAME)
private String firstName;No, that property is for the name of the identity, typically the user name. Any other fields you add won't need the @IdentityProperty annotation.
So I should create an Authenticator class. ?No, the JpaIdentityStore will handle it.
Can you give me a more detailed example ?https://github.com/seam/seam-example-confbuzz uses the second approach I mentioned (adding things to the IdentityObject entity.
-
6. Re: Using Name, Surname Attributes in Seam Security 3
benan.aktas Dec 10, 2011 6:40 PM (in response to benan.aktas)Hi
Thank you for your reply. You give ma a very good example. But in all examples there is nothing about how to use IdentityAttribute class. Can you explain this with an example? -
7. Re: Using Name, Surname Attributes in Seam Security 3
adan Dec 15, 2011 2:34 PM (in response to benan.aktas)You can just use PicketLink's AttributesManager.
@Inject IdentitySession identitySession;
public void doTest() {
PersistenceManager pm = identitySession.getPersistenceManager();
AttributesManager attribManager = identitySession.getAttributesManager();
User user = pm.findUser("john");
attribManager.addAttribute(user, "firstName", "John");
attribManager.addAttribute(user, "lastName", "Doe");
}
AttributesManager has many nice features which you can utilize in your customized solution. For instance to fetch attribute's value you can use:
attribManager.getAttribute(user, "firstName");
Regads,
Adan -
8. Re: Using Name, Surname Attributes in Seam Security 3
lightguard Dec 15, 2011 5:53 PM (in response to benan.aktas)Thanks Adam. That's a good example.
-
9. Re: Using Name, Surname Attributes in Seam Security 3
benan.aktas Dec 16, 2011 8:42 AM (in response to benan.aktas)Thank you for reply. But I want to ask that there is nothing how to use
Attribute and Identity entities togetherWe have an Attribute entity and I want to use this. I dont want to add manually
like
'attribManager.addAttribute(user,firstName
,John
);'Since I have Attribute entity in examples.
-
10. Re: Using Name, Surname Attributes in Seam Security 3
lightguard Dec 16, 2011 4:36 PM (in response to benan.aktas)@Benan, the best approach is to use the AttributeManager from PicketLink. The entities technically aren't meant to be accessed and modified any other way. Of course, you're welcome to access them via JPA, but there will be no support for going that route, and you could mess up the relationships / settings / etc.
-
11. Re: Using Name, Surname Attributes in Seam Security 3
adan Dec 18, 2011 3:04 PM (in response to benan.aktas)I would like to notice, that using AttributeManager in connection with JpaIdentityStore is not very useful right now.
Why?
Current version doesn't contain implementations of the following methods:
- findIdentityObjectByUniqueAttribute
- getAttributesMetaData
- getSupportedAttributeNames
- getIdentityObjectsCount
and several others.As a consequence, methods like findUserByUniqueAttribute won't work.
-
12. Re: Using Name, Surname Attributes in Seam Security 3
lightguard Dec 19, 2011 4:02 PM (in response to benan.aktas)Would you please submit a JIRA feature request for those? They may have been missed.
-
13. Re: Using Name, Surname Attributes in Seam Security 3
benan.aktas Dec 19, 2011 4:25 PM (in response to benan.aktas)