splash only code for external website

Asked by Kim

i would like to setup an external login but i have trouble in setting up the code.
could someone give me te code to show the "connect" button you get when using splash only.

Question information

Language:
English Edit question
Status:
Solved
For:
AuthPuppy Edit question
Assignee:
No assignee Edit question
Solved by:
Kim
Solved:
Last query:
Last reply:
Revision history for this message
gbastien (gbastien02) said :
#1

If you use the php script from the authpuppy wiki http://www.authpuppy.org/doc/Typical_usage_scenarios_with_plugins

To make it work with the splash only authenticator, you would have to change the POSTFIELDS line for this:

curl_setopt($curl_session, CURLOPT_POSTFIELDS,
     "authenticator=apAuthSplashOnly&submit[apAuthSplashOnlyConnect]=Connect&gw_id=default&gw_address=192.168.1.1&gw_port=2060");

Revision history for this message
Kim (kpm) said :
#2

thanks! but i don't understand that code (i am not programmer). Is it possible to give me a piece of code i can paste into the page i want to use?

Revision history for this message
gbastien (gbastien02) said :
#3

If you don't want to bother with your own php script, here is what your external page could look like

The html would look something like this:

... <!-- The beginning of your page here -->
<form action="http://yourserver/login" method="POST">
                    <input type="hidden" name="gw_id" value="<gw_id_get_parameter>"/>
                   <input type="hidden" name="gw_address" value="<gw_address_get_parameter>"/>
                   <input type="hidden" name="gw_port" value="<gw_port_get_parameter>"/>
                    <input type="submit" name="submit[apAuthSplashOnlyConnect]" value="Connect" />
</form>

where the values of the hidden fields come from the gateway as get parameters in the url.

Revision history for this message
Kim (kpm) said :
#4

thank you for the code, i have put the code in the page but i get this error

The node you're trying to access does not exist on the server.

AND

csrf token: Required

I checked the node-id and it's ok, do you know what could be wrong?

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Kim (kpm) said :
#6

nooooo! i still need an answer,please

Revision history for this message
gbastien (gbastien02) said :
#7

Can you post the actual html code you get on your login page please?

Revision history for this message
Kim (kpm) said :
#8

this is the only code i use:

<form action="http://hotspot.nethosting.nl/login" method="POST">
                    <input type="hidden" name="gw_id" value="<gw_id_get_parameter>"/>
                   <input type="hidden" name="gw_address" value="<gw_address_get_parameter>"/>
                   <input type="hidden" name="gw_port" value="<gw_port_get_parameter>"/>
                    <input type="submit" name="submit[apAuthSplashOnlyConnect]" value="Connect" />
</form>

Revision history for this message
gbastien (gbastien02) said :
#9

And do you replace the hidden values like gw_id_get_parameters by what they actually are? They should come in the url as $_GET parameters like such:

http://your.server/login/?gw_id=default&gw_address=192.168.1.1&gw_port=2060

If you are using the apExternalCMSPlugin, you should have checked the "Redirect login page" checkbox and make sure your login url contains the following:
[url]?%getparameters%[&other parameters you need]

Revision history for this message
Kim (kpm) said :
#10

This is wat i have put in the login page redirection
http://www.ksh-solutions.nl/aanbieding/%friendlyname%/index.php?%getparameters%

are there any other items i have to change?

Revision history for this message
gbastien (gbastien02) said :
#11

So the url you receive is something like this:

http://www.ksh-solutions.nl/aanbieding/mynode/index.php?gw_id=default&gw_address=192.168.1.1&gw_port=2060

And in this case, the form code should be:

<form action="http://hotspot.nethosting.nl/login" method="POST">
                    <input type="hidden" name="gw_id" value="default"/>
                   <input type="hidden" name="gw_address" value="192.168.1.1"/>
                   <input type="hidden" name="gw_port" value="2060"/>
                    <input type="submit" name="submit[apAuthSplashOnlyConnect]" value="Connect" />
</form>

Revision history for this message
Kim (kpm) said :
#12

Thank you very much!! it works now, i am very happy :-)

Revision history for this message
Lane Franklin (shatzi825) said :
#13

where is this code entered?
am I supposed to create file somewhere?

Revision history for this message
Brian Converse (bconverse) said :
#14

I have the above working when the values a manually entered in to hidden fields. But of course in this instance you would need a separate login page for each node.

Can you be a little more detailed on how to get the login page to substitute the values in the url and put them in the hidden fields so I can have one login page for all nodes.

Thanks

Revision history for this message
gbastien (gbastien02) said :
#15

It depends a lot on your php page and how it is generated, but you could have something like this in your login php file:

<form action="http://hotspot.nethosting.nl/login" method="POST">
                    <input type="hidden" name="gw_id" value="<?php echo $_GET['gw_id']?>"/>
                   <input type="hidden" name="gw_address" value="<?php echo $_GET['gw_address']?>"/>
                   <input type="hidden" name="gw_port" value="<?php echo $_GET['gw_port']?>"/>
                    <input type="submit" name="submit[apAuthSplashOnlyConnect]" value="Connect" />
</form>

Revision history for this message
Brian Converse (bconverse) said :
#16

gbastien,

Your a gentleman and a scholar - works great!

Thank You