Changeset 2461
- Timestamp:
- 09/18/08 11:45:07 (4 months ago)
- Location:
- trunk/otis
- Files:
-
- 22 modified
-
config/otis-config.server.xml (modified) (1 diff)
-
src/org/bandit/otis/api/IRole.java (modified) (1 diff)
-
src/org/bandit/otis/impl/CommonRole.java (modified) (4 diffs)
-
src/org/bandit/otis/impl/CommonRolesCache.java (modified) (5 diffs)
-
src/org/bandit/otis/impl/CommonTTLCache.java (modified) (6 diffs)
-
src/org/bandit/otis/impl/LocalAuthSession.java (modified) (9 diffs)
-
src/org/bandit/otis/impl/OtisAuditAppender.java (modified) (3 diffs)
-
src/org/bandit/otis/impl/OtisAuditRecord.java (modified) (1 diff)
-
src/org/bandit/otis/impl/RemoteAuthSession.java (modified) (1 diff)
-
src/org/bandit/otis/impl/RemoteEndPointClient.java (modified) (1 diff)
-
src/org/bandit/otis/impl/SAMLPolicyAuthMethod.java (modified) (1 diff)
-
src/org/bandit/otis/impl/UsernamePasswordAuthMethod.java (modified) (1 diff)
-
src/org/bandit/otis/server/AuditLogHandler.java (modified) (3 diffs)
-
src/org/bandit/otis/server/AuthenticatedSessionHandler.java (modified) (3 diffs)
-
src/org/bandit/otis/server/EntityHandler.java (modified) (3 diffs)
-
src/org/bandit/otis/server/OtisServlet.java (modified) (14 diffs)
-
src/org/bandit/otis/server/PathManager.java (modified) (1 diff)
-
src/org/bandit/otis/server/RoleHandler.java (modified) (8 diffs)
-
src/org/bandit/otis/utils/ConvertToBoolean.java (modified) (2 diffs)
-
src/org/bandit/otis/utils/ExcludeDoclet.java (modified) (1 diff)
-
src/org/bandit/otis/utils/SAMLTokenGenerator.java (modified) (2 diffs)
-
src/org/bandit/otis/utils/UriBuilder.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/otis/config/otis-config.server.xml
r2455 r2461 139 139 attrIDOk = "Query part not allowed in attr ID URI"; 140 140 } 141 else if (attrURI.getRawFragment() != null)142 {143 attrIDOk = "Fragment part not allowed in attr ID URI";144 }141 // else if (attrURI.getRawFragment() != null) 142 // { 143 // attrIDOk = "Fragment part not allowed in attr ID URI"; 144 // } 145 145 else 146 146 { -
trunk/otis/src/org/bandit/otis/api/IRole.java
r2430 r2461 26 26 * methods. 27 27 */ 28 public interface IRole extends IConfigurable28 public interface IRole 29 29 { 30 30 /** -
trunk/otis/src/org/bandit/otis/impl/CommonRole.java
r2447 r2461 36 36 public class CommonRole implements IRole 37 37 { 38 Map<String, ?> m_settings;38 // Map<String, ?> m_settings; 39 39 private Map<String, Object> m_members; 40 40 41 41 private void _init(String roleId) throws AuthSessionException 42 42 { 43 m_settings = null;44 43 m_members = new HashMap<String, Object>(); 45 44 … … 183 182 Object value = m_members.get(name); 184 183 185 if ( value == null && m_settings != null)186 {184 // if ( value == null && m_settings != null) 185 //{ 187 186 /* Todo: find policy for mapping item, map item, save cached value in map */ 188 }187 //} 189 188 190 189 if ( name.equals(IRole.roleId) && value != null) … … 203 202 } 204 203 205 206 public void configure(207 Map<String, ?> mapSettings) throws AuthSessionException208 {209 m_settings = mapSettings;210 }211 212 204 public String getRoleActivationMethod() throws AuthSessionException 213 205 { … … 280 272 } 281 273 274 public int hashCode() { 275 return super.hashCode(); 276 } 277 282 278 public boolean equals(Object o) 283 279 { -
trunk/otis/src/org/bandit/otis/impl/CommonRolesCache.java
r2447 r2461 20 20 import java.util.Map; 21 21 22 import org.bandit.otis.api.IConfigurable;23 22 import org.bandit.otis.api.IRole; 24 23 import org.bandit.otis.api.AuthSessionException; … … 30 29 * @exclude 31 30 */ 32 public class CommonRolesCache implements IConfigurable31 public class CommonRolesCache 33 32 { 34 private Map<String, ?> m_settings;35 33 36 34 private HashMap<String, CommonTTLCache> m_caches; … … 38 36 public CommonRolesCache() 39 37 { 40 m_settings = null;41 38 m_caches = new HashMap<String, CommonTTLCache>(); 42 39 } … … 177 174 /** 178 175 * External mechanism for invalidating the cache. 179 * @throws AuthSessionException180 176 */ 181 177 public void clear(String cacheName) … … 191 187 } 192 188 193 public void configure( 194 Map<String, ?> mapSettings) throws AuthSessionException 195 { 196 m_settings = mapSettings; 197 } 198 189 199 190 } -
trunk/otis/src/org/bandit/otis/impl/CommonTTLCache.java
r2430 r2461 31 31 * @exclude 32 32 */ 33 public class CommonTTLCache implements IConfigurable33 public class CommonTTLCache 34 34 { 35 private Map<String, ?> m_settings;36 private static Iterable<Object> m_empty;37 35 CacheObject m_cache; 38 36 39 37 private void _init(int ttlSeconds) 40 38 { 41 m_settings = null;42 39 ArrayList<CacheObject> cache = new ArrayList<CacheObject>(); 43 40 long expire = java.lang.Long.MAX_VALUE; … … 49 46 cacheElement = new CacheObject(cache, ttlSeconds); 50 47 m_cache = cacheElement; 51 m_empty = new CacheIter(null);52 48 } 53 49 … … 110 106 } 111 107 112 return m_empty;108 return new CacheIter(null); 113 109 } 114 110 … … 184 180 } 185 181 186 public void configure(187 Map<String, ?> mapSettings) throws AuthSessionException188 {189 m_settings = mapSettings;190 }191 192 182 /** 193 183 * wrapper for the real object, allows us to remember caching parameters … … 196 186 * 197 187 */ 198 private class CacheObject188 private static class CacheObject 199 189 { 200 190 private Object m_obj; … … 258 248 * Create a new ImmutableIterator 259 249 */ 260 private class CacheIter implements Iterator<Object>, Iterable<Object>250 private static class CacheIter implements Iterator<Object>, Iterable<Object> 261 251 { 262 252 private Iterator<?> _realIterator; -
trunk/otis/src/org/bandit/otis/impl/LocalAuthSession.java
r2430 r2461 32 32 import org.eclipse.higgins.idas.api.IFilter; 33 33 import org.eclipse.higgins.idas.api.ISimpleAttrValue; 34 import org.eclipse.higgins.idas.api.ITypedValue;35 34 import org.eclipse.higgins.idas.api.IdASException; 36 35 import org.eclipse.higgins.idas.common.ContextSpecificFilterExtension; … … 73 72 private CommonRolesCache m_roleCache; 74 73 private long m_lastAccessTime = java.lang.Long.MAX_VALUE; 75 private static Iterator<IRole> m_empty;76 74 private String m_strOriginatorLocationName = null; 77 75 private String m_strOriginatorLocationAddress = null; … … 131 129 this.configure( settings); 132 130 133 m_empty = (Iterator<IRole>) (new EmptyIterator());134 135 131 m_roleCache = new CommonRolesCache(); 136 132 m_authMethodsUsedList = new ArrayList(); … … 234 230 if ((configAuthMethodSettings = (Map)methodItem.getMethodSettings()) != null) 235 231 { 236 Iterator settingsIter = configAuthMethodSettings.keySet().iterator(); 237 while (settingsIter.hasNext()) 238 { 239 String strKey = (String)settingsIter.next(); 240 authMethodSettings.put( strKey, configAuthMethodSettings.get( strKey)); 241 } 232 authMethodSettings.putAll( configAuthMethodSettings); 242 233 } 243 234 if (authMethodSettings.get( Constants.AUTH_METHOD_CONTEXT_REGISTRY) == null && … … 776 767 // just let it slide, return an empty cache 777 768 } 778 return m_empty;769 return (Iterator<IRole>) (new EmptyIterator()); 779 770 } 780 771 … … 951 942 CommonRolesCache roleCache) throws AuthSessionException 952 943 { 953 final String[] totalParamNames = {"authSession", "cacheName", "roleCache", "authmethods"};954 955 944 if (getSettings() == null) 956 945 throw new AuthSessionException("No policy configured for :" + this.getClass().getName()); … … 1110 1099 else 1111 1100 { 1112 if ( data == null) 1113 m_log.error("Non Simple Value found found on Attr: " + attr.getAttrID().toString() + " while evaluating rule: " ); 1114 else 1115 m_log.error("Unknown data type: "+ data.getClass().getCanonicalName() + 1116 " found on Attr: " + attr.getAttrID().toString() + " while evaluating rule: " ); 1101 m_log.error("Non Simple Value found found on Attr: " + attr.getAttrID().toString() + " while evaluating rule: " ); 1117 1102 } 1118 1103 } // end of attr value iter loop … … 1565 1550 * 1566 1551 */ 1567 private class EmptyIterator implements Iterator<IRole>1552 private static class EmptyIterator implements Iterator<IRole> 1568 1553 { 1569 1554 public boolean hasNext() … … 1619 1604 m_log.debug("NULL event information values array not allowed when information name array is non-null"); 1620 1605 } 1621 if (strEventInfoNames.length != strEventInfoValues.length)1606 else 1622 1607 { 1623 m_log.debug("Number of event information names (" + strEventInfoNames.length + ") does not " + 1624 "match the number of event information values (" + strEventInfoValues.length + ")"); 1625 } 1626 for (int iLoop = 0; iLoop < strEventInfoNames.length; iLoop++) 1627 { 1628 m_auditRecord.addEventInfo( strEventInfoNames [iLoop], strEventInfoValues [iLoop]); 1608 if (strEventInfoNames.length != strEventInfoValues.length) 1609 { 1610 m_log.debug("Number of event information names (" + strEventInfoNames.length + ") does not " + 1611 "match the number of event information values (" + strEventInfoValues.length + ")"); 1612 } 1613 for (int iLoop = 0; iLoop < strEventInfoNames.length; iLoop++) 1614 { 1615 m_auditRecord.addEventInfo( strEventInfoNames [iLoop], strEventInfoValues [iLoop]); 1616 } 1629 1617 } 1630 1618 } -
trunk/otis/src/org/bandit/otis/impl/OtisAuditAppender.java
r2237 r2461 96 96 int iMajorStatusCode; 97 97 int iMinorStatusCode; 98 int iReadLen; 98 99 99 100 putInt( iRecordLen + 20, ucBuf, 0); … … 114 115 // Peek at the return buffer to get buffer size needed 115 116 116 m_inputStream.read( ucBuf, 0, 4);117 iReadLen = m_inputStream.read( ucBuf, 0, 4); 117 118 iResponseLen = getInt( ucBuf, 0) - 4; 118 119 if (ucBuf.length < iResponseLen) … … 121 122 } 122 123 123 m_inputStream.read(ucBuf, 0, iResponseLen); 124 iReadLen = m_inputStream.read(ucBuf, 0, iResponseLen); 125 if ( iReadLen != iResponseLen) 126 throw new AuditException( ""); 124 127 iMajorStatusCode = getInt(ucBuf, 0); 125 128 iMinorStatusCode = getInt(ucBuf, 4); -
trunk/otis/src/org/bandit/otis/impl/OtisAuditRecord.java
r2237 r2461 23 23 24 24 import java.util.Map; 25 import java.util.HashMap;26 import java.util.List;27 import java.util.ArrayList;28 import java.util.Iterator;29 25 30 26 import java.util.Date; -
trunk/otis/src/org/bandit/otis/impl/RemoteAuthSession.java
r2455 r2461 1438 1438 1439 1439 Document responseDoc = response.getResponseBodyDoc(); 1440 Map properties = new HashMap();1441 1440 Element propertyElement; 1442 1441 if (responseDoc != null) -
trunk/otis/src/org/bandit/otis/impl/RemoteEndPointClient.java
r2417 r2461 73 73 m_endPoint = setting.trim(); 74 74 // _checkOptions(); 75 }76 77 /**78 * make sure we really cleanup, including any parents79 */80 protected void finalize() throws Throwable81 {82 try83 {84 85 }86 finally87 {88 super.finalize();89 }90 75 } 91 76 -
trunk/otis/src/org/bandit/otis/impl/SAMLPolicyAuthMethod.java
r2416 r2461 57 57 public class SAMLPolicyAuthMethod extends CommonAuthMethod 58 58 { 59 private static URI ISSUER_URI ;59 private static URI ISSUER_URI = URI.create("urn:issuer");; 60 60 61 61 private Log m_log = LogFactory.getLog( SAMLPolicyAuthMethod.class.getName()); 62 62 private String m_authEntityId; 63 63 64 static {65 try66 {67 ISSUER_URI = new URI("urn:issuer");68 }69 catch (Exception e)70 {71 // nothing to see, do, buy, photograph, or eat here. Your code reached this point and you didn't even get72 // a lousy t-shirt.73 }74 }75 64 public SAMLPolicyAuthMethod() 76 65 { 66 77 67 } 78 68 -
trunk/otis/src/org/bandit/otis/impl/UsernamePasswordAuthMethod.java
r2416 r2461 113 113 strPassword = (String)value; 114 114 115 // Make sure we got both a username and password116 117 if (strUserName == null)118 {119 throwException( "No value specified for authentication material '" + Constants.AUTH_MATERIAL_USERNAME + "'");120 }121 if (strPassword == null)122 {123 throwException( "No value specified for authentication material '" + Constants.AUTH_MATERIAL_PASSWORD + "'");124 }125 126 115 try 127 116 { -
trunk/otis/src/org/bandit/otis/server/AuditLogHandler.java
r2433 r2461 18 18 import javax.servlet.http.HttpServletRequest; 19 19 20 import org.bandit.otis.api.AuthSessionException;21 20 import org.bandit.otis.utils.Constants; 22 21 … … 31 30 32 31 import java.util.Map; 33 import java.util.HashMap;34 32 import java.util.ArrayList; 35 33 … … 371 369 if (iHttpResponseCode != HttpServletResponse.SC_OK) 372 370 { 373 responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE, new Integer( iHttpResponseCode));371 responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE, Integer.valueOf( iHttpResponseCode)); 374 372 } 375 373 return( strTemplateFile); -
trunk/otis/src/org/bandit/otis/server/AuthenticatedSessionHandler.java
r2433 r2461 589 589 } 590 590 591 authMaterialMap.put( Constants.TEMPLATE_MUST_GATHER_ALL_CHILDREN, new Boolean( authMaterial.mustGatherAllChildren()));591 authMaterialMap.put( Constants.TEMPLATE_MUST_GATHER_ALL_CHILDREN, Boolean.valueOf( authMaterial.mustGatherAllChildren())); 592 592 if ((childAuthMaterials = authMaterial.getChildMaterials()) != null) 593 593 { … … 1474 1474 UriBuilder requestURI = new UriBuilder(request.getRequestURL()); 1475 1475 1476 requestURI.setPath(request.getRequestURI() .toString());1476 requestURI.setPath(request.getRequestURI()); 1477 1477 requestURI.terminatePathAfter((String)nounList.get(0)); 1478 1478 strNounURL = requestURI.buildString(); … … 1597 1597 if (iHttpResponseCode != HttpServletResponse.SC_OK) 1598 1598 { 1599 responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE, new Integer( iHttpResponseCode));1599 responseMap.put( Constants.TEMPLATE_HTTP_RESPONSE_CODE, Integer.valueOf( iHttpResponseCode)); 1600 1600 } 1601 1601 if (strSessionID != null) -
trunk/otis/src/org/bandit/otis/server/EntityHandler.java
r2453 r2461 831 831 if (strNodeElementName.equals( RESTConstants.REST_ATTRIBUTE_ELEMENT)) 832 832 { 833 this.addAttribute( strSessionID, "Entity='" + strEntityID + "'", entity, (Element)childNode, false, responseMap);833 this.addAttribute( strSessionID, "Entity='" + strEntityID, entity, (Element)childNode, false, responseMap); 834 834 } 835 835 else … … 1992 1992 else 1993 1993 { 1994 Map attrMap = (Map)attrs.get( 0); 1995 Iterator attrMapIter = attrMap.keySet().iterator(); 1996 while (attrMapIter.hasNext()) 1997 { 1998 String strKey = (String)attrMapIter.next(); 1999 responseMap.put( strKey, attrMap.get( strKey)); 2000 } 1994 responseMap.putAll( (Map)attrs.get( 0) ); 2001 1995 } 2002 1996 }