ADFS Timeouts – Keep Above 10 Minutes When Testing

I ran into this issue very recently when helping with an ADFS environment setup that was using a federation proxy to an internal federation service farm. The timeout desire was to be 15 minutes, after a user would have to re-authenticate to the ADFS box. To expedite the testing, we were attempting to set short intervals of timeouts, 1-2 minutes…up to 5, however nothing was timing out fumbling the proof of concept. Over around 8 minutes was timing out though. Furthermore, there was never a concrete timeout; there was always some level of skew.

This behavior seemed erratic. The problem is ADFS has a Cache Scavenge interval, which is the process for purging out-of-date cache records from the client cache. If your timeouts are configured in a pretty orthodox way, for example a ten minute timeout:

On the SharePoint box:

[code]
$sts = Get-SPSecurityTokenServiceConfig
$sts.LogonTokenCacheExpirationWindow = (New-TimeSpan –minutes 1)
$sts.Update()
Iisreset
[/code]

And on the ADFS box:

[code]
Set-ADFSRelyingPartyTrust -TargetName Relying Party Common Name -TokenLifeTime 10
[/code]

But you have your TokenLifeTime set to a ridiculously low value (it always has to be above the LoginTokenCacheExpirationWindow btw) such as two, resulting in a difference of a one minute timeout; the Cache Scavenge will never fire. Thus the issued ticket will be considered valid.

Take away is always just test with something like 10 minutes and deal with the wait time for verification.

Share

Adding A ProgressBar Column To A RadGrid In A SharePoint WebPart

I really thought there would be a tutorial on this on the Telerik website but I couldn’t find anything relevant. In this post, I am going to show you how to add a progress bar column to a RadGrid or RadGridView. So, my goal is to have something like this:

I am just setting the value in a master/detail view in a straight forward TextBox. I am not using AJAX or anything so some of the wiring to maintain values is simply to deal with PostBacks. Just looks like this:

Firstly, I am going to use the one from CodeProject, which is used in a lot of apps, for example the SnapStream project. You can view the SVN version here:

http://source.snapstream.com/repos/WebAdministration/controls/ProgressBar.cs

Blah Blah blah here is the code.

The ITemplate to wire up to the custom column:

[csharp]
public void InstantiateIn(Control container)
{
UpdatePanel panel = new UpdatePanel();
ProgressBar bar = new ProgressBar();
bar.ID = “bar”;
bar.ForeColor = Color.Black;
bar.Width = Unit.Pixel(150);
bar.FillImageUrl = string.Format(“{0}/Supporting%20Images/bg.gif”, SharePointHelpers.SiteUrl);
bar.BarImageUrl = string.Format(“{0}/Supporting%20Images/indicator.gif”, SharePointHelpers.SiteUrl);
bar.Visible = true;
bar.Enabled = true;
panel.ContentTemplateContainer.Controls.Add(bar);
container.Controls.Add(panel);
}
}
[/csharp]

The template column to add to the grid:

[csharp]
var x = new GridTemplateColumn();
x.AllowFiltering = false;
x.HeaderText = “Percentage Complete”;
x.ItemTemplate = new ProgressBarTemplate();
grid.MasterTableView.Columns.Add(x);
[/csharp]
Wire up the data bound event:
[csharp]
public static void grid_ItemDataBound(object sender, GridItemEventArgs e)
{
var nestedItem = e.Item as GridNestedViewItem;
if (nestedItem != null)
{
Panel panel = (Panel) nestedItem.FindControl(“InnerContainer”);
TextBox tbPercentage = (TextBox) panel.FindControlRecursive(“tbPercentage”);
tbPercentage.Text = DataBinder.Eval(e.Item.DataItem, “Percentage”) != null
? DataBinder.Eval(e.Item.DataItem, “Percentage”).ToString() : “[None]”;

TextBox tb = (TextBox) nestedItem.FindControlRecursive(“tbPercentage”);
GridDataItem parentItem = nestedItem.ParentItem;
ProgressBar bar = (ProgressBar) parentItem.FindControlRecursive(“bar”);
string x = tb.Text;
bar.Percentage = Convert.ToInt32(x);
}
}
[/csharp]

Wire up this prerender event to the grid:

[csharp]
public void grid_PreRender(object sender, EventArgs e)
{
foreach (GridDataItem y in _grid.Items)
{
if (y.ChildItem != null)
{
GridNestedViewItem nestedItem = y.ChildItem;
TextBox tb = (TextBox) nestedItem.FindControlRecursive(“tbPercentage”);
ProgressBar bar = (ProgressBar) y.FindControlRecursive(“bar”);
string x = tb.Text;
bar.Percentage = Convert.ToInt32(x);
}
}
}
[/csharp]

Wire up the item created event:

[csharp]
public static void grid_ItemCreated(object sender, GridItemEventArgs e)
{
var item = e.Item as GridDataItem;
if (item != null)
{
if (item.ChildItem != null)
{
GridNestedViewItem nestedItem = item.ChildItem;
TextBox tb = (TextBox) nestedItem.FindControlRecursive(“tbPercentage”);
ProgressBar bar = (ProgressBar) item.FindControlRecursive(“bar”);
string x = tb.Text;
bar.Percentage = Convert.ToInt32(x);
}
}
}
[/csharp]

Like I said depending on the technology you are using you might not need like half of those events.

Share