Я использую Spring Security SAML 1.0.1, и я хочу знать значение атрибута SAML, чье имя «Edupersonaffiliation». Я закодировал класс, который реализует org.springframework.security.saml.userdetails.samluserdetailsservice интерфейс и в методе LogleuserBysaml я делаю это:
@Override
public Object loadUserBySAML(SAMLCredential credential) throws UsernameNotFoundException {
String eduPersonAffiliationAttributeName = "";
// We need to use the "name" of the attribute to retrieve the value (not the friendly name)
for (Attribute attribute : credential.getAttributes()) {
if ("eduPersonAffiliation".equals(attribute.getFriendlyName())) {
eduPersonAffiliationAttributeName = attribute.getName();
}
}
Person user = usersService.getUser(
credential.getAttribute(eduPersonAffiliationAttributeName).WHAT_TO_CALL_HERE?);
return loadUserByUser(user);
}
< /code>
Метод GetUser < /code> ожидает строки, которая должна быть входом в систему подключенного пользователя. Вопрос звучит глупо, но как я могу получить доступ к значению атрибута с учетом имени атрибута? Я вижу метод org.opensaml.saml2.core.getattributevalues
, который возвращает список . Как его использовать? < /P>
Я использую Spring Security SAML 1.0.1, и я хочу знать значение атрибута SAML, чье имя «Edupersonaffiliation». Я закодировал класс, который реализует org.springframework.security.saml.userdetails.samluserdetailsservice интерфейс и в методе LogleuserBysaml я делаю это:
[code]@Override public Object loadUserBySAML(SAMLCredential credential) throws UsernameNotFoundException { String eduPersonAffiliationAttributeName = ""; // We need to use the "name" of the attribute to retrieve the value (not the friendly name) for (Attribute attribute : credential.getAttributes()) { if ("eduPersonAffiliation".equals(attribute.getFriendlyName())) { eduPersonAffiliationAttributeName = attribute.getName(); } } Person user = usersService.getUser( credential.getAttribute(eduPersonAffiliationAttributeName).WHAT_TO_CALL_HERE?); return loadUserByUser(user); } < /code>
Метод GetUser < /code> ожидает строки, которая должна быть входом в систему подключенного пользователя. Вопрос звучит глупо, но как я могу получить доступ к значению атрибута с учетом имени атрибута? Я вижу метод org.opensaml.saml2.core.getattributevalues [/code], который возвращает список . Как его использовать? < /P>