11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

810 <strong>Improving</strong> <strong>Web</strong> <strong>Application</strong> <strong>Security</strong>: <strong>Threats</strong> <strong>and</strong> Countermeasures(continued)}else{_storePermFlag &= ~StorePermissionFlag.User;}}get {return (_storePermFlag & StorePermissionFlag.User).Equals(StorePermissionFlag.User);}10. Implement IPermission.Copy. This creates an identical copy of the currentpermission instance <strong>and</strong> returns it to the caller.public override IPermission Copy(){return new EncryptionPermission(_permFlag, _storePermFlag);}11. Implement IPermission.Intersect. This returns a permission object that is theresult of the set intersection between the current permission <strong>and</strong> the suppliedpermission.public override IPermission Intersect(IPermission target){// An input of null indicates a permission with no state.// There can be no common state, so the method returns null.if (target == null)return null;if (!(target.GetType().Equals(this.GetType())))throw new ArgumentException("Argument must be of type EncryptionPermission.");// Cast target to an EncryptionPermission.EncryptionPermission targetPerm = (EncryptionPermission)target;EncryptionPermissionFlag intersectEncryption = this._permFlag &targetPerm._permFlag;StorePermissionFlag intersectStore = this._storePermFlag &targetPerm._storePermFlag;return new EncryptionPermission(intersectEncryption, intersectStore);}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!