Configuring Mixed Authentication in SharePoint

brickborderΑσφάλεια

3 Νοε 2013 (πριν από 3 χρόνια και 11 μήνες)

104 εμφανίσεις

Configuring Mixed Authentication in SharePoint

By: Md. Fazlul Alam Chowdhury

Email: mdfachowdhury@hotmail.com

1.

Step 1: Create a Membership Database to Store SQL membership and Roles

-

Open Visual Studio Command Prompt

-

Run ASPNET_REGSQL

A all

E. It will crea
te a new database named
aspnetdb into the local SQL Server

2.

Step 2: Extend an existing Web Application for
Form Authentication

using following steps:

-

Go to SharePoint Administration

-

Click on Application Management

-

Click on Create/Extend Web Application


-

Cl
ick on Extend an existing web application

-

Select the Primary Intranet Web Application. Enter the Host Header [ex.
Mysite.Chowdhury.Com]

and Select the port 80


-

Select the Zone as Internet


-

Click Ok to extend the existing intranet site to Internet Site wi
th Forms
Authentication

3.

Step 3:
Open Web.Config from SharePoint Administration Site and update the
Web.Config according to the following instruction:

-

Add the following section after the SharePoint Section [
</
SharePoint
>]
:

<
connectionStrings
>


<
add

name
=
"
S
qlProviderConnection
"

connectionString
=
"
server=(l ocal);database=aspnetdb;Trusted_Connection=True
"

/>

</
connectionStrings
>

-

Add the following
sub
-
sections

inside system.web section:

<
membership

defaultProvider
=
"
AspNetSqlMembershi pProvider
"
>




<
providers
>





<
remove

name
=
"
AspNetSqlMembershipProvi der
"

/>





<
add

connectionStringName
=
"
SqlProvi derConnection
"

name
=
"
AspNetSqlMembershipProvider
"

applicationName
=
"
/
"

type
=
"
System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, P
ublicKeyToken=b03f5f7f11d50a3a
"

/>




</
providers
>

</
membership
>

<
roleManager

enabled
=
"
true
"

defaultProvider
=
"
AspNetWindowsTokenRol eProvider
"
>




<
providers
>





<
remove

name
=
"
AspNetSqlRoleProvi der
"

/>





<
add

connectionStringName
=
"
SqlProvi derConnecti
on
"

applicationName
=
"
/
"

description
=
"
Stores and retrieves roles data from the local
Microsoft SQL Server database
"

name
=
"
AspNetSqlRoleProvi der
"

type
=
"
System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5
f7f11d50a3a
"

/>




</
providers
>

</
roleManager
>

4.

Step 4: Open Web.Config from Extended SharePoint Application and update the
Web.Config according to the following instruction

[Only difference with Step 3 is
AspNetSqlRoleProvider
for Extended Sharepoint Appl
ication and

AspNetWindowsTokenRoleProvider
for SharePoint Administration’s Web.Config
]
:

-

Add the following section after the SharePoint Section [
</
SharePoint
>]
:

<
connectionStrings
>


<
add

name
=
"
SqlProviderConnection
"

connectionString
=
"
server=(l ocal);databas
e=aspnetdb;Trusted_Connection=True
"

/>

</
connectionStrings
>

-

Add the following sub
-
sections inside system.web section:

<
membership

defaultProvider
=
"
AspNetSqlMembershi pProvider
"
>




<
providers
>





<
remove

name
=
"
AspNetSqlMembershipProvi der
"

/>





<
add

co
nnectionStringName
=
"
SqlProvi derConnection
"

name
=
"
AspNetSqlMembershipProvider
"

applicationName
=
"
/
"

type
=
"
System.Web.Security.SqlMembershipProvider, System.Web,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
"

/>




</
providers
>

</
membersh
ip
>

<
roleManager

enabled
=
"
true
"

defaultProvider
=
"

AspNetSqlRoleProvider
"
>




<
providers
>





<
remove

name
=
"
AspNetSqlRoleProvi der
"

/>





<
add

connectionStringName
=
"
SqlProvi derConnection
"

applicationName
=
"
/
"

description
=
"
Stores and retrieves roles data f
rom the local
Microsoft SQL Server database
"

name
=
"
AspNetSqlRoleProvi der
"

type
=
"
System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
"

/>




</
providers
>

</
roleManager
>

5.

Step
5
:
Restart IIS in

SharePoint Server

[From Visual Studio Command Prompt issue
IISRESET]

6.

Step 6: Change Authentication Provider to Forms.

Go to SharePoint Administration
-
>Application Management
-
>Authentication Providers
-
>Internet


Then Change the Authentication to
Forms

and

make sure that the Membership and Role
provider are same as your Web.Config. Then, click on
Yes

on Enable Client Integration.


7.

Step
7
:
Create Users/Roles/Rules in the Membership Database:
Create
an

ASP .NET
Web Application from Visual Studio and Edit the

Web.Config file. Update the
file with the
following content and update the
machineKey

element from Extended SharePoint
Application
-
>Web.Config’s
machineKey

<?
xml

version
=
"
1.0
"
?>

<!
--



Note: As an alternative to hand editing this file you can use the


web admin tool to configure settings for your application. Use


the Website
-
>Asp.Net Configuration option in Visual Studio.


A full list of settings and comments can be found in


machine.config.comments usually located in


\
Windows
\
Micros
oft.Net
\
Framework
\
v2.x
\
Confi g

--
>

<
configuration
>


<
connectionStrings
>



<
add

name
=
"
SqlProviderConnection
"

connectionString
=
"
server=(l ocal);database=aspnetdb;Trusted_Connection=True
"

/>


</
connectionStrings
>


<
system.web
>




<
authentication

mode
=
"
Forms
"

/>




<
machineKey

validationKey
=
"
9058DB92AA3D38E95CACC3507EC5B7504AB8D76F057132FC
"

decryptionKey
=
"
EBCDCA7666A99E53557048A6492BD3856EC2FEF9D6B6C304
"

validation
=
"
SHA1
"

/>




<
membership

defaultProvider
=
"
AspNetSqlMembershipProvi der
"
>




<
providers
>





<
cle
ar
/>





<!
--
<remove name="AspNetSqlMembershipProvider" />
-
-
>





<
add

connectionStringName
=
"
SqlProviderConnection
"

applicationName
=
"
/
"

name
=
"
AspNetSqlMembershipProvider
"

type
=
"
System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0,
Culture
=neutral, PublicKeyToken=b03f5f7f11d50a3a
"

/>




</
providers
>




</
membership
>




<
roleManager

enabled
=
"
true
"
>




<
providers
>





<
clear
/>





<!
--
<remove name="AspNetSqlRoleProvi der" />
--
>




<
add

connectionStringName
=
"
SqlProviderConnection
"

appli
cationName
=
"
/
"





description
=
"
Stores and retrieves roles data from the local
Microsoft SQL Server database
"





name
=
"
AspNetSqlRoleProvi der
"

type
=
"
System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.3600.0,
Culture=neutral, PublicKeyToken=b03f5f
7f11d50a3a
"

/>




</
providers
>




</
roleManager
>



<
compilation

debug
=
"
true
"
/>


</
system.web
>

</
configuration
>


8.

Step
8
:
Go to

Website

Menu from Visual Studio 2005 and Click on ASP .NET
Configuration

or
Go to

Project Menu in Visual Studio 2008 and Click
on ASP .NET
Configuration
. Then go to Security to Create/Modify User/Role/rules. For Anonymous
access, please
go to

add

new Access Rule
. Here we will create a new user named:
MyTestUser
.



9.

Step
9
:

Go to

SharePoint Administration to grant a
ccess to the ne
wly created user from
the Membership Database.


-

Go to Application Management

-

Click on Policy for Web Application

-

Select the Initial Web Application from the Web Application selection dropdown
at the top right corner

-

Click on Add User

and select the appropr
iate Zone [The zone for the extended
web application. i.e
Internet
]

-

Click Next

-

Type the user name
MyTestUser

in the Users Text box and choose the right
permission for that user

-

Click Finish to Create the User


10.

Step 10: Log into your internet site and login

as
MyTestUser