use of org.apache.karaf.jaas.config.JaasRealm in project ddf by codice.
the class UPBSTValidator method addRealm.
public void addRealm(ServiceReference<JaasRealm> serviceReference) {
Bundle bundle = FrameworkUtil.getBundle(UPBSTValidator.class);
if (null != bundle) {
JaasRealm realm = bundle.getBundleContext().getService(serviceReference);
LOGGER.trace("Adding validator for JaasRealm {}", realm.getName());
JAASUsernameTokenValidator validator = new JAASUsernameTokenValidator();
validator.setContextName(realm.getName());
validators.put(realm.getName(), validator);
}
}
use of org.apache.karaf.jaas.config.JaasRealm in project ddf by codice.
the class UsernamePasswordRealmTest method setup.
@Before
public void setup() {
List<ClaimsHandler> claimsHandlers = new ArrayList<>();
claimsHandlers.add(mock(ClaimsHandler.class));
claimsHandlers.add(mock(ClaimsHandler.class));
ClaimsCollection claims1 = new ClaimsCollectionImpl();
ClaimImpl email1 = new ClaimImpl("email");
email1.addValue("test@example.com");
claims1.add(email1);
ClaimsCollection claims2 = new ClaimsCollectionImpl();
ClaimImpl email2 = new ClaimImpl("email");
email2.addValue("tester@example.com");
claims2.add(email2);
when(claimsHandlers.get(0).retrieveClaims(any())).thenReturn(claims1);
when(claimsHandlers.get(1).retrieveClaims(any())).thenReturn(claims2);
upRealm.setClaimsHandlers(claimsHandlers);
JaasRealm jaasRealm = mock(JaasRealm.class);
when(jaasRealm.getName()).thenReturn("realm");
upRealm.realmList.add(jaasRealm);
}
use of org.apache.karaf.jaas.config.JaasRealm in project ddf by codice.
the class UsernamePasswordRealm method removeRealm.
public void removeRealm(ServiceReference<JaasRealm> serviceReference) {
Bundle bundle = FrameworkUtil.getBundle(UsernamePasswordRealm.class);
if (null != bundle) {
JaasRealm realm = bundle.getBundleContext().getService(serviceReference);
LOGGER.trace("Removing validator for JaasRealm {}", realm.getName());
realmList.remove(realm);
}
}
Aggregations