/** * In this implementation the 'credentials are just the * already hashed password */ public boolean authentify (final Object credentials) throws AuthException { if (this.hashedPassword == null) { throw new AuthException ("Cannot authentify Principal against a principal copy"); } //log.debug("credentials : >"+credentials+"<"); //log.debug("hashedPassword : >"+this.hashedPassword+"<"); return (this.hashedPassword.equals(credentials)); }
throw new AuthException ("init failed", cce); throw new AuthException ("Parameter '"+NAME+"' is missing for Principal building");
public void init (final java.util.Map initParams) throws AuthException { this.name = (String)initParams.get(NAME); if (this.name == null) { throw new AuthException ("Parameter '"+NAME+"' is mandatory"); } try { this.url = (String)initParams.get(CODE_SOURCE); if (this.url == null) this.url = (String)initParams.get(LOCATION); if (log.isDebugEnabled()) log.debug("init() url is >"+this.url+"<"); final Certificate[] certs = null; this.codeSource = new CodeSource (new java.net.URL(FileUtils.expandUrl(this.url)), certs); } catch (Exception e) { throw new AuthException ("Failed to determine '"+CODE_SOURCE+"'", e); } }
public Permission decodePermission (org.jdom.Element e) throws AuthException { try { java.util.Map params = Parameters.extractAttributes(e); String className = (String)params.get(CLASS); Class permissionClass = Class.forName(className); final Permission p = (Permission)ReflectionUtils .buildInstance(permissionClass, params); //log.debug("decodePermission() decoded "+p); return p; } catch (Exception ex) { throw new AuthException ("Failed to decode permission", ex); } }
protected Grant extractGrant (org.jdom.Element elt) throws AuthException { String name = elt.getAttributeValue(NAME); String url = elt.getAttributeValue(CODEBASE); java.util.Set permissions = new java.util.HashSet(); java.util.Iterator it = elt.getChildren(PERMISSION).iterator(); while (it.hasNext()) { java.security.Permission p = permissionCodec.decodePermission((org.jdom.Element)it.next()); permissions.add(p); } try { return new Grant(name, url, permissions); } catch (Exception e) { throw new AuthException ("Failed to extract Grant", e); } }
throw new AuthException ("Cannot decode Principal from class "+o.getClass(), cce); throw new AuthException ("null XML element or not a <"+E_PRINCIPAL+">"); throw new AuthException ("failed to build Principal of class "+className, e);
throw new AuthException ("No principal named '"+principalName+"' found");
throw new AuthException ("Waiting for xml element named '"+PASSWD+ "' not '"+elt.getName()+"'.");
/** * Writes the current state of the Passwd object to file (as an XML * document). */ public void encodePasswd (final Passwd p) throws AuthException { org.jdom.Element ePasswd = (org.jdom.Element)doEncodePasswd(p); try { String fileName = this.docUrl.toString(); if (fileName.startsWith("file:")) fileName = fileName.substring(5); final java.io.FileWriter writer = new java.io.FileWriter(fileName); final org.jdom.output.XMLOutputter out = XmlUtils.getXMLOutputter(); out.output(new org.jdom.Document(ePasswd), writer); } catch (final java.io.IOException ie) { throw new AuthException ("Failed to output passwd back to "+this.docUrl, ie); } }
throw new AuthException ("didn't find data source", se); throw new AuthException ("Failed to clean tables", se); throw new AuthException ("Failed to insert principal parameters", se); throw new AuthException ("Failed to insert grants", se);
throw new AuthException ("Cannot extract xml out of object >"+o+"<", e); throw new AuthException ("Cannot turn your >"+o+"< into a Passwd instance."); throw new AuthException ("Failed to decode XML document '"+this.docUrl+"'", e);
public Passwd decodePasswd () throws AuthException { OwfeDataSource ds = null; try { ds = SqlUtils.lookupDataSource(context, serviceParams); } catch (final ServiceException se) { throw new AuthException ("didn't find data source", se); } try { return new Passwd ("passwd", // ???????????TODO?????????????????????????????? decodePrincipals(ds.getConnection()), decodeGrants(ds.getConnection())); } catch (Exception e) { throw new AuthException ("failed to load passwd info", e); } finally { ds.releaseConnection(); } }