{"id":126,"date":"2014-07-10T14:27:02","date_gmt":"2014-07-10T12:27:02","guid":{"rendered":"https:\/\/www.vioreliftode.com\/?p=126"},"modified":"2016-04-15T13:38:28","modified_gmt":"2016-04-15T11:38:28","slug":"active-directory-security-groups-and-sharepoint-claims-based-authentication","status":"publish","type":"post","link":"https:\/\/www.vioreliftode.com\/index.php\/active-directory-security-groups-and-sharepoint-claims-based-authentication\/","title":{"rendered":"Active Directory Security Groups and SharePoint Claims Based Authentication"},"content":{"rendered":"<input class=\"fooboxshare_post_id\" type=\"hidden\" value=\"126\"\/><p><em>It&#8217;s not happening only on SharePoint 2013. You will be in the same\u00a0situation if you are using\u00a0Claims Based Authentication\u00a0with\u00a0SharePoint 2010.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">Out of the box behavior<\/span><br \/>\nYou have a SharePoint Web Application configured to use Claims Based Authentication. You grant access to a SharePoint site through Active Directory Security Groups. You perform changes in the membership of that Active Directory Security Group and you notice the changes are not reflected immediately on the SharePoint site.<br \/>\nFor example you remove one user account from the AD security group membership, but the user is still able to access the site, or you add a new user to the membership of that security group, but the user still receives access denied on\u00a0SharePoint.<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\">The explanation<\/span><br \/>\nSharePoint Claims Based Authentication is working differently than SharePoint Classic Mode Authentication. When you have Claims Based Authentication, SharePoint is using the Security Token Service (STS) to provide\u00a0access tokens for server-to-server authentication.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"http:\/\/en.wikipedia.org\/wiki\/Security_token_service\" target=\"_blank\">The Wikipedia explanation for STS<\/a>:<br \/>\n<em>&#8220;A Security Token Service (STS) is a software based identity provider responsible for issuing security tokens, especially software tokens, as part of a claims-based identity system.<\/em><br \/>\n<em>In a typical usage scenario, a client requests access to a secure software application, often called a relying party. Instead of the application authenticating the client, the client is redirected to an STS. The STS authenticates the client and issues a security token. Finally, the client is redirected back to the relying party and present the security token. The token is the data record in which claims are packed, and is protected from manipulation with strong cryptography. The software application verifies that the token originated from an STS trusted by it, and then makes authorization decisions accordingly. The token is creating a chain of trust between the STS and the software application consuming the claims. This process is illustrated in the Security Assertion Markup Language (SAML) use case, demonstrating how single sign-on can be used to access web services.&#8221;<\/em><\/p>\n<p>&nbsp;<\/p>\n<p>So, in our case:<\/p>\n<ul>\n<li>a claims based SharePoint web application handle requests to issue, manage, and validate security tokens.<span style=\"color: #2a2a2a;\">\u00a0<\/span><\/li>\n<li>the s<span style=\"color: #2a2a2a;\">ecurity tokens are a collection of identity claims (a user name, a role, an identifier).<\/span><\/li>\n<li>the security tokens can be protected\u00a0<span style=\"color: #2a2a2a;\">with an X.509 certificate to protect the token&#8217;s contents in transit and to enable validation of trusted issuers.<\/span><\/li>\n<li>the SharePoint\u00a0Security Token Service plays an important role for the\u00a0claims based SharePoint web application.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p><strong><span style=\"text-decoration: underline;\">The problem<\/span><\/strong><br \/>\nThe tokens have a lifetime (by default 10 hours). More than that, SharePoint by default <span style=\"color: #333333;\">will cache the AD security group membership details\u00a0for 24 hours.<\/span>\u00a0That means, once the SharePoint will get the details for a security group, if the AD security group will change, SharePoint will still use the cache.<\/p>\n<p>&nbsp;<\/p>\n<p><strong><span style=\"text-decoration: underline;\">Solution<\/span><\/strong><\/p>\n<p>When your access in SharePoint rely on the AD security groups you have to adjust the caching mechanism for the tokens and you have to adjust it properly everywhere (SharePoint and STS).<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\nAdd-PSSnapin Microsoft.SharePoint.PowerShell;\r\n\r\n$CS = [Microsoft.SharePoint.Administration.SPWebService]::ContentService;\r\n#TokenTimeout value before\r\n$CS.TokenTimeout;\r\n$CS.TokenTimeout = (New-TimeSpan -minutes 2);\r\n#TokenTimeout value after\r\n$CS.TokenTimeout;\r\n$CS.update();\r\n\r\n$STSC = Get-SPSecurityTokenServiceConfig\r\n#WindowsTokenLifetime value before\r\n$STSC.WindowsTokenLifetime;\r\n$STSC.WindowsTokenLifetime = (New-TimeSpan -minutes 2);\r\n#WindowsTokenLifetime value after\r\n$STSC.WindowsTokenLifetime;\r\n#FormsTokenLifetime value before\r\n$STSC.FormsTokenLifetime;\r\n$STSC.FormsTokenLifetime = (New-TimeSpan -minutes 2);\r\n#FormsTokenLifetime value after\r\n$STSC.FormsTokenLifetime;\r\n#LogonTokenCacheExpirationWindow value before\r\n$STSC.LogonTokenCacheExpirationWindow;\r\n#DO NOT SET LogonTokenCacheExpirationWindow LARGER THAN WindowsTokenLifetime\r\n$STSC.LogonTokenCacheExpirationWindow = (New-TimeSpan -minutes 1);\r\n#LogonTokenCacheExpirationWindow value after\r\n$STSC.LogonTokenCacheExpirationWindow;\r\n$STSC.Update();\r\nIISRESET\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>More details<\/strong><\/span><br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.administration.spwebservice.contentservice.ASPX\" target=\"_blank\">SPWebService.ContentService<br \/>\n<\/a><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.administration.spwebservice.tokentimeout(v=office.15).aspx\" target=\"_blank\">SPWebService.TokenTimeout<br \/>\n<\/a><a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/ff607642(v=office.15).aspx\" target=\"_blank\">Get-SPSecurityTokenServiceConfig<br \/>\n<\/a><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.administration.claims.spsecuritytokenservicemanager_members(v=office.15).aspx\" target=\"_blank\">SPSecurityTokenServiceManager<br \/>\n<\/a><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.administration.claims.spsecuritytokenservicemanager.windowstokenlifetime(v=office.15).aspx\" target=\"_blank\">SPSecurityTokenServiceManager.WindowsTokenLifetime<br \/>\n<\/a><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.administration.claims.spsecuritytokenservicemanager.formstokenlifetime(v=office.15).aspx\" target=\"_blank\">SPSecurityTokenServiceManager.FormsTokenLifetime<br \/>\n<\/a><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/microsoft.sharepoint.administration.claims.spsecuritytokenservicemanager.logontokencacheexpirationwindow(v=office.15).aspx\" target=\"_blank\">SPSecurityTokenServiceManager.LogonTokenCacheExpirationWindow<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s not happening only on SharePoint 2013. You will be in the same\u00a0situation if you are using\u00a0Claims Based Authentication\u00a0with\u00a0SharePoint 2010. &nbsp; Out of the box behavior You have a SharePoint Web Application configured to use Claims Based Authentication. You grant access to a SharePoint site through Active Directory Security Groups. You perform changes in the &hellip; <a href=\"https:\/\/www.vioreliftode.com\/index.php\/active-directory-security-groups-and-sharepoint-claims-based-authentication\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Active Directory Security Groups and SharePoint Claims Based Authentication<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"Active Directory Security Groups and SharePoint Claims Based Authentication http:\/\/wp.me\/p4NfDd-22","jetpack_is_tweetstorm":false},"categories":[29],"tags":[44,94],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4NfDd-22","_links":{"self":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/posts\/126"}],"collection":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/comments?post=126"}],"version-history":[{"count":0,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/posts\/126\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/media?parent=126"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/categories?post=126"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vioreliftode.com\/index.php\/wp-json\/wp\/v2\/tags?post=126"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}