Вы находитесь на странице: 1из 4

IFM WAM INTEGRATED SECONDARY ATTRIBUTE CODE CHANGE DOCUMNET WAM

 Flowchart

1) Product :- .Net IFM Wam Integrated.


IFM WAM INTEGRATED SECONDARY ATTRIBUTE CODE CHANGE DOCUMNET WAM

2) Module impacted :- Uidpfederation.


3) Class file Impacted :- federationutil.cs
4) Method impacted :- getSecurityPrincipal.
public static SecurityPrincipal getSecurityPrincipal
(TargetDomain targetDomain, string protocol, string nameType)

5) New method Added :- public static Dictionary<string , string> executeDBOperation()


6) Parameter accepted:- prinicipalid.
7) Return value:- Dictionary<string , string>

 Code changes in getSecurityPrincipal method:-

Trace.WriteLineIf(traceSwitch.TraceVerbose, "Adding the secondary attributes


value from DB --Start--", traceCategory);
for (int k = 0; k<publishedAttrs.Length; k++)
{
if (publishedAttrs[k].AttributeName.ToLower().ToString() ==
fromdatabase".ToLower().ToString())
{
Dictionary<string, string> attrKeyValue = executeDBOperation(principalId);
int arry_len = attrKeyValue.Count;
Array.Resize(ref secAttrs, secAttrs.Length + arry_len);
foreach (KeyValuePair<string, string> kv in attrKeyValue)
{
// secAttrs[i].name = entry.Key;
// secAttrs[i].values = new[] { attr_val };
string attr_val = kv.Value;
secAttrs[secAttrs.Length - arry_len] = new SecurityAttribute();
secAttrs[secAttrs.Length - arry_len].name = kv.Key;
secAttrs[secAttrs.Length - arry_len].values = new[] { attr_val };
Trace.WriteLineIf(traceSwitch.TraceVerbose, "secondary Attribute from
DB: Attribute name:- [" + kv.Key.ToString() + "] || Value:- [" + attr_val
+ "]", traceCategory);
arry_len++;
}
}

 ExecuteDBOperation method:-
IFM WAM INTEGRATED SECONDARY ATTRIBUTE CODE CHANGE DOCUMNET WAM

public static Dictionary<string , string> executeDBOperation(string principalId)


{
var attr_KV = new Dictionary<string, string>();
try
{
//Get the "Assembly path" name from the web.config
var Assembly_path = ConfigurationManager.AppSettings["AssemblyName"];
Trace.WriteLineIf(traceSwitch.TraceError, "Assembly Path:- " +
Assembly_path.ToString(), traceCategory);
var DLL = Assembly.LoadFile(Assembly_path);
string FullyQualified_dll_name = DLL.GetName().ToString();
Trace.WriteLineIf(traceSwitch.TraceError, "Fully Qualified DLL Name :- " +
FullyQualified_dll_name.ToString(), traceCategory);
object[] obj_dll = FullyQualified_dll_name.Split(',');
FullyQualified_dll_name = obj_dll[0].ToString();

//Get the Class name from the Assembly


string classname = ConfigurationManager.AppSettings["className"];
Trace.WriteLineIf(traceSwitch.TraceError, "ClassName:- " +
classname.ToString(), traceCategory);
string dll_class = FullyQualified_dll_name + "." + classname;
var get_Type = DLL.GetType(dll_class.Replace(" ", string.Empty));
var c = Activator.CreateInstance(get_Type);

//Get the method name from the class


string _methodName = ConfigurationManager.AppSettings["methodName"];
Trace.WriteLineIf(traceSwitch.TraceError, "Method Name:- " +
_methodName.ToString(), traceCategory);
var method = get_Type.GetMethod(_methodName.Replace(" ", string.Empty));

Dictionary<string, string> sndry_Attribute =(Dictionary<string,string>)


method.Invoke(c, new object[] { principalId });

foreach (KeyValuePair<string, string> kv in sndry_Attribute)


{
attr_KV.Add(kv.Key,kv.Value);

}
catch (Exception exc)
{
Trace.WriteLineIf(traceSwitch.TraceVerbose, "[executeDBOperation] exception
occured. Error:- " + exc.Message.ToString(), traceCategory);
}
return attr_KV;

 Web.config changes
IFM WAM INTEGRATED SECONDARY ATTRIBUTE CODE CHANGE DOCUMNET WAM

Below are the new key value tags need to be added in the web.config file under
“appsetting” element. This will give the info about the third party/client DLL

1) <add key="AssemblyName" value="assembly path" />


 Assembly path :- Path of the assembly where it is stored.

2) <add key="className" value="name of the class" />


3) <add key="methodName" value="name of the method" />
 This method from the specified dll must return ‘Key_Value’ Datatype as the
return type.

 Why these tags in Web.config


The above mentioned ‘executeDBOperation’ method will fetch the Assembly/Dll name,Class
name,Method name from these tags and performs the secondary attribute adding process to
the saml assertion.

It is mandatory to specify these parameters/names in the web.config, the class and method
names should match exactly in the DLL as specified in the web.config file.

Вам также может понравиться