/** * Convenience method which returns the Realm object representing * the current default realm. Equivalent to * getInstance(getDefaultRealm()). * * @return Realm representing default realm. * @exception NoSuchRealmException if default realm does not exist */ public static synchronized Realm getDefaultInstance() throws NoSuchRealmException { return getInstance(getDefaultRealm()); }
/** * Convenience method which returns the Realm object representing * the current default realm. Equivalent to * getInstance(getDefaultRealm()). * * @return Realm representing default realm. * @exception NoSuchRealmException if default realm does not exist */ public static synchronized Realm getDefaultInstance() throws NoSuchRealmException { return getInstance(getDefaultRealm()); }
/** * Convenience method which returns the Realm object representing * the current default realm. Equivalent to * getInstance(getDefaultRealm()). * * @return Realm representing default realm. * @exception NoSuchRealmException if default realm does not exist */ public static Realm getDefaultInstance() throws NoSuchRealmException { return getInstance(getDefaultRealm()); }
public static Subject jmacLogin(Subject subject, String identityAssertion, String realm) throws LoginException { if (subject == null) { subject = new Subject(); } final Subject fs = subject; String userName = identityAssertion; try { if (realm == null || "".equals(realm)) { realm = Realm.getDefaultRealm(); } Realm realmInst = Realm.getInstance(realm); final Enumeration groups = realmInst.getGroupNames(userName); if (groups != null && groups.hasMoreElements()) { AppservAccessController.doPrivileged(new PrivilegedAction() { public java.lang.Object run() { while (groups.hasMoreElements()) { String grp = (String) groups.nextElement(); fs.getPrincipals().add(new Group(grp)); } return fs; } }); } } catch (Exception ex) { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Exception when trying to populate groups for CallerPrincipal " + identityAssertion, ex); } } return subject; }
public static Subject jmacLogin(Subject subject, String identityAssertion, String realm) throws LoginException { if (subject == null) { subject = new Subject(); } final Subject fs = subject; String userName = identityAssertion; try { if (realm == null || "".equals(realm)) { realm = Realm.getDefaultRealm(); } Realm realmInst = Realm.getInstance(realm); final Enumeration groups = realmInst.getGroupNames(userName); if (groups != null && groups.hasMoreElements()) { AppservAccessController.doPrivileged(new PrivilegedAction() { public java.lang.Object run() { while (groups.hasMoreElements()) { String grp = (String) groups.nextElement(); fs.getPrincipals().add(new Group(grp)); } return fs; } }); } } catch (Exception ex) { if (_logger.isLoggable(Level.FINE)) { _logger.log(Level.FINE, "Exception when trying to populate groups for CallerPrincipal " + identityAssertion, ex); } } return subject; }
/** * This method is just a convenience wrapper for * <i>login(Subject, Class)</i> method. It will construct a * PasswordCredential class. * * @param String username * @param String password * @param String realmName the name of the realm to login into, if realmName * is null, we login into the default realm */ public static void login(String username, char[] password, String realmName){ if(realmName == null || !(Realm.isValidRealm(realmName))){ realmName = Realm.getDefaultRealm(); } final Subject fs = new Subject(); final PasswordCredential pc = new PasswordCredential(username, password, realmName); AppservAccessController.doPrivileged(new PrivilegedAction(){ public java.lang.Object run(){ fs.getPrivateCredentials().add(pc); return fs; } }); LoginContextDriver.login(fs, PasswordCredential.class); }
/** * This method is just a convenience wrapper for * <i>login(Subject, Class)</i> method. It will construct a * PasswordCredential class. * * @param String username * @param String password * @param String realmName the name of the realm to login into, if realmName * is null, we login into the default realm */ public static void login(String username, char[] password, String realmName){ if(realmName == null || !(Realm.isValidRealm(realmName))){ realmName = Realm.getDefaultRealm(); } final Subject fs = new Subject(); final PasswordCredential pc = new PasswordCredential(username, password, realmName); AppservAccessController.doPrivileged(new PrivilegedAction(){ public java.lang.Object run(){ fs.getPrivateCredentials().add(pc); return fs; } }); LoginContextDriver.login(fs, PasswordCredential.class); }
byte[] _realm = null; if (target_name == null || target_name.length == 0) { _realm = Realm.getDefaultRealm().getBytes(); } else { _realm = GSSUtils.importName(GSSUtils.GSSUP_MECH_OID, target_name);
realmName = Realm.getDefaultRealm();
realmName = Realm.getDefaultRealm();
/** * A special case login for GSSUPName credentials. * */ private static void doGSSUPLogin(Subject s) throws LoginException { if(_logger.isLoggable(Level.FINE)){ _logger.fine("Processing GSSUP login."); } String user = null; String realm = Realm.getDefaultRealm(); try{ Object obj = getPublicCredentials(s, GSSUPName.class); user = ((GSSUPName)obj).getUser(); setSecurityContext(user, s, realm); if(getAuditManager().isAuditOn()){ getAuditManager().authentication(user, realm, true); } if (_logger.isLoggable(Level.FINE)) { _logger.fine("GSSUP login succeeded for : " + user); } } catch (LoginException le){ if(getAuditManager().isAuditOn()){ getAuditManager().authentication(user, realm, false); } throw le; } }
/** * A special case login for GSSUPName credentials. * */ private static void doGSSUPLogin(Subject s) throws LoginException { if(_logger.isLoggable(Level.FINE)){ _logger.fine("Processing GSSUP login."); } String user = null; String realm = Realm.getDefaultRealm(); try{ Object obj = getPublicCredentials(s, GSSUPName.class); user = ((GSSUPName)obj).getUser(); setSecurityContext(user, s, realm); if(getAuditManager().isAuditOn()){ getAuditManager().authentication(user, realm, true); } if (_logger.isLoggable(Level.FINE)) { _logger.fine("GSSUP login succeeded for : " + user); } } catch (LoginException le){ if(getAuditManager().isAuditOn()){ getAuditManager().authentication(user, realm, false); } throw le; } }
realmName = Realm.getDefaultRealm();
realmName = Realm.getDefaultRealm();