OpenId

From no name for this wiki
Jump to: navigation, search

Keywords

  • PAPE (Provider Authentication Policy Extension) allows web developers to request other modifications to the flow, such as asking that Google reprompt the user for their password.

Specifications

google

http://code.google.com/apis/accounts/docs/OpenID.html

Request URL erstellen

package test;
 
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
 
public class Main {
 
    public static void main(String... args) throws Exception {
 
        Map<String, String> map = new HashMap<String, String>();
        map.put("openid.claimed_id", "http://specs.openid.net/auth/2.0/identifier_select");
        map.put("openid.identity", "http://specs.openid.net/auth/2.0/identifier_select");
        map.put("openid.return_to", "http://www.claude-glauser.ch/php/printparameters.php");
        map.put("openid.realm", "http://www.claude-glauser.ch");
        map.put("openid.mode", "checkid_setup");
        map.put("openid.ns", "http://specs.openid.net/auth/2.0");
        map.put("openid.assoc_handle", "ABCCCC987");
        map.put("openid.ns.ax", "http://openid.net/srv/ax/1.0");
        map.put("openid.ax.mode", "fetch_request");
        map.put("openid.ax.type.email", "http://axschema.org/contact/email");
        map.put("openid.ax.type.firstname", "http://axschema.org/namePerson/first");
        map.put("openid.ax.type.lastname", "http://axschema.org/namePerson/last");
        map.put("openid.ax.required", "email,firstname,lastname");
 
        StringBuilder sb = new StringBuilder();
        sb.append("https://www.google.com/accounts/o8/ud?");
 
        Iterator<Entry<String, String>> iterator = map.entrySet().iterator();
 
        while (iterator.hasNext()) {
            Entry<String, String> first = iterator.next();
            sb.append(URLEncoder.encode(first.getKey(), "UTF-8"));
            sb.append("=");
            sb.append(URLEncoder.encode(first.getValue(), "UTF-8"));
 
            if (iterator.hasNext()) {
                sb.append("&");
            }
        }
 
        System.out.println(sb.toString());
    }
}