Welcome Guest, Not a member yet? Register   Sign In
Using Windows authentication
#1

[eluser]jprateragg[/eluser]
I'm looking at porting our existing application to CodeIgniter. Our application currently runs on Windows server. The application doesn't have a formal login system--it captures the $_SERVER['AUTH_USER'] of the currently logged in user, queries the database for a matching user name, then creates and loads session data indicating the user is logged in. Is there a way to mimic that with CodeIgniter? I've created a login controller, but I don't know how to get the $_SERVER['AUTH_USER'] to it since it's not accessible within the class. I appreciate any help. Thanks!
#2

[eluser]jprateragg[/eluser]
I created a custom config file (config2.php) and added the following line to it:

Code:
$config['user'] = $_SERVER['AUTH_USER'];

I was able to access it through all of my controllers so I think this will do the trick. Is there a better way to do this or should this work fine? Thanks!
#3

[eluser]Patrick Spence[/eluser]
[quote author="jprateragg" date="1351889051"]I created a custom config file (config2.php) and added the following line to it:

Code:
$config['user'] = $_SERVER['AUTH_USER'];

I was able to access it through all of my controllers so I think this will do the trick. Is there a better way to do this or should this work fine? Thanks![/quote]

the input class encapsulates the server variable.

http://ellislab.com/codeigniter/user-gui...input.html

specifically $this->input->server('AUTH_USER') should do what you need to get the data.

You could easily write a library that grabs that and encapsulates the verification and session management as well.
#4

[eluser]jprateragg[/eluser]
[quote author="Patrick Spence" date="1351911376"]the input class encapsulates the server variable.

http://ellislab.com/codeigniter/user-gui...input.html

specifically $this->input->server('AUTH_USER') should do what you need to get the data.

You could easily write a library that grabs that and encapsulates the verification and session management as well.
[/quote]
Ah! That works well too! I never thought about that. I'm still new to CodeIgniter and after reading the manual once I haven't been able to retain everything yet. Smile
#5

[eluser]Patrick Spence[/eluser]
[quote author="jprateragg" date="1351979305"][quote author="Patrick Spence" date="1351911376"]the input class encapsulates the server variable.

http://ellislab.com/codeigniter/user-gui...input.html

specifically $this->input->server('AUTH_USER') should do what you need to get the data.

You could easily write a library that grabs that and encapsulates the verification and session management as well.
[/quote]
Ah! That works well too! I never thought about that. I'm still new to CodeIgniter and after reading the manual once I haven't been able to retain everything yet. Smile[/quote]

Yeah, I still find more things all the time in there as I come up with new projects to work on. Smile




Theme © iAndrew 2016 - Forum software by © MyBB