>> How can I get attributes related to DataBase Authentication Provider, not
>> Tacacs Authentication Provider? Because with this last, there is no
>> attributes.
>> @Override
>> public Map<String, String> getAllTokens(String organization) throws
>> GuacamoleException {
>> final Map<String, String> tokens = new HashMap<String,
>> String>();
>> for (Map.Entry<String, GuacamoleSession> entry :
>> this.sessionMap.entrySet()) {
>> GuacamoleSession session = entry.getValue();
>> Map<String, String> attr =
>> session.getUserContext(session.getAuthenticatedUser()
>>
>> .getAuthenticationProvider().getIdentifier()).self()
>> .getAttributes();
>> if
>> (attr.get(User.Attribute.ORGANIZATION).equals(organization)
>> &&
>> !attr.get(User.Attribute.FULL_NAME).equals(USER_KILL_SESSION)) {
>>
>> tokens.put(entry.getValue().getAuthenticatedUser()
>>
>> .getCredentials().getUsername(), entry.getKey());
>> }
>> }
>> return tokens;
>> }
>> And is throwing a null exception in this line:
>> if (attr.get(User.Attribute.ORGANIZATION).equals(organization) &&
>> !attr.get(User.Attribute.FULL_NAME).equals(USER_KILL_SESSION)) {
I have found a solution
@Override
public Map<String, String> getAllTokens(String organization) throws
GuacamoleException {
final Map<String, String> tokens = new HashMap<String, String>();
for (Map.Entry<String, GuacamoleSession> entry :
this.sessionMap.entrySet()) {
GuacamoleSession session = entry.getValue();
Map<String, String> attr =
session.getUserContext(AUTH_PROVIDER_DB).self().getAttributes();
if (attr != null &&
attr.get(User.Attribute.ORGANIZATION).equals(organization)
&&
!attr.get(User.Attribute.FULL_NAME).equals(USER_KILL_SESSION)) {
tokens.put(entry.getValue().getAuthenticatedUser()
.getCredentials().getUsername(), entry.getKey());
}
}
return tokens;
}
This was a solution:
Map<String, String> attr =
session.getUserContext(AUTH_PROVIDER_DB).self().getAttributes();
-Gabriel
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]