JaasLoginService loginService = new JaasLoginService("HmacSHA1", "secret", cl, null);
PrincipalInfo.PrincipalEditor principalEditor = new PrincipalInfo.PrincipalEditor();
principalEditor.setAsText("metro,org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal,false");
GenericSecurityRealm realm = new GenericSecurityRealm(domainName, loginModuleUse, true, true, (PrincipalInfo) principalEditor.getValue(), serverInfo, cl, null, loginService);
loginService.setRealms(Collections.singleton(realm));
loginService.doStart();
GeronimoLoginConfiguration loginConfiguration = new GeronimoLoginConfiguration();