Produced by Araxis Merge on 10/26/2017 10:44:23 PM Eastern Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Fri Oct 27 02:44:23 2017 UTC | ||
| 2 | OSCIF_BMS_v2_iter 2_September_2017.zip\BMS_Cand\Source\Sources\BMS.Vista.TestEis\BMS.Utils | SecurityUtils.cs | Wed Oct 18 18:47:02 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 0 | 0 |
| Changed | 0 | 0 |
| Inserted | 1 | 82 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | using Syst em; | |||||
| 2 | using Syst em.Collect ions.Gener ic; | |||||
| 3 | using Syst em.Linq; | |||||
| 4 | using Syst em.Text; | |||||
| 5 | using Syst em.Identit yModel.Cla ims; | |||||
| 6 | using Syst em.Service Model; | |||||
| 7 | using Syst em.Web.Ses sionState; | |||||
| 8 | ||||||
| 9 | namespace BMS.Utils | |||||
| 10 | { | |||||
| 11 | public class Sec urityUtils | |||||
| 12 | { | |||||
| 13 | pr ivate stat ic Claim G etContextC laim(strin g claimTyp e) | |||||
| 14 | { | |||||
| 15 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 16 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 17 | { | |||||
| 18 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 19 | } | |||||
| 20 | try | |||||
| 21 | { | |||||
| 22 | Clai m result = null; | |||||
| 23 | if ( OperationC ontext.Cur rent == nu ll || Oper ationConte xt.Current .ServiceSe curityCont ext == nul l | |||||
| 24 | | | Operatio nContext.C urrent.Ser viceSecuri tyContext. Authorizat ionContext == null | |||||
| 25 | | | Operatio nContext.C urrent.Ser viceSecuri tyContext. Authorizat ionContext .ClaimSets == null) | |||||
| 26 | return res ult; | |||||
| 27 | fore ach (Claim Set claimS et in Oper ationConte xt.Current .ServiceSe curityCont ext.Author izationCon text.Claim Sets) | |||||
| 28 | { | |||||
| 29 | foreach (C laim claim in claimS et) | |||||
| 30 | if (cl aim.ClaimT ype == cla imType) | |||||
| 31 | { | |||||
| 32 | re sult = cla im; | |||||
| 33 | br eak; | |||||
| 34 | } | |||||
| 35 | if (result != null) | |||||
| 36 | break; | |||||
| 37 | } | |||||
| 38 | retu rn result; | |||||
| 39 | } | |||||
| 40 | finally | |||||
| 41 | { | |||||
| 42 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 43 | { | |||||
| 44 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 45 | } | |||||
| 46 | } | |||||
| 47 | } | |||||
| 48 | // / <summary > | |||||
| 49 | // / Get the current us ername fro m the WCF Operation context an d security claims. | |||||
| 50 | // / </summar y> | |||||
| 51 | // / <returns >Full user name (doma in\usernam e)</return s> | |||||
| 52 | pu blic stati c string G etUserName () | |||||
| 53 | { | |||||
| 54 | DateTime entryInLo gMethodTim e = DateTi me.UtcNow; | |||||
| 55 | if (Info World.Trac ing.IWTrac e.IsEntryE nabled) | |||||
| 56 | { | |||||
| 57 | Info World.Trac ing.IWTrac e.Entry(Sy stem.Refle ction.Meth odBase.Get CurrentMet hod(), ent ryInLogMet hodTime); | |||||
| 58 | } | |||||
| 59 | try | |||||
| 60 | { | |||||
| 61 | Clai m claim = GetContext Claim(User NameClaimT ype); | |||||
| 62 | if ( claim != n ull) | |||||
| 63 | { | |||||
| 64 | return cla im.Resourc e.ToString (); | |||||
| 65 | } | |||||
| 66 | retu rn string. Empty; | |||||
| 67 | ||||||
| 68 | } | |||||
| 69 | finally | |||||
| 70 | { | |||||
| 71 | if ( InfoWorld. Tracing.IW Trace.IsEx itEnabled) | |||||
| 72 | { | |||||
| 73 | InfoWorld. Tracing.IW Trace.Exit (System.Re flection.M ethodBase. GetCurrent Method(), DateTime.U tcNow, ent ryInLogMet hodTime); | |||||
| 74 | } | |||||
| 75 | } | |||||
| 76 | } | |||||
| 77 | ||||||
| 78 | pr ivate cons t string U serNameCla imType = @ "urn:oasis :names:tc: SAML:2.0:n ameid-form at:Windows DomainQual ifiedName/ UserName"; | |||||
| 79 | ||||||
| 80 | ||||||
| 81 | } | |||||
| 82 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.