Exemplo n.º 1
0
        public override GenericAuth.AuthenticationConclusion createConclusion(OpenID20.AuthenticationResponse inputMSG)
        {
            var AuthenticationResponse = (AuthenticationResponse)inputMSG;
            var AuthConclusion         = new GenericAuth.AuthenticationConclusion();

            AuthConclusion.channel = inputMSG.SVX_sender;
            var userProfile = new UserProfile();

            userProfile.UserID   = inputMSG.FieldsExpectedToBeSigned.theParams.openid__identity;
            userProfile.Identity = inputMSG.FieldsExpectedToBeSigned.theParams.openid__identity;

            userProfile.Email    = ((FieldsExpectedToBeSigned)inputMSG.FieldsExpectedToBeSigned.theParams).openid__ax__value__email;
            userProfile.FullName = ((FieldsExpectedToBeSigned)inputMSG.FieldsExpectedToBeSigned.theParams).openid__ax__value__fullname;

            if (inputMSG.FieldsExpectedToBeSigned.theParams.openid__return_to != return_to_uri)
            {
                throw new Exception("return_to in the authentication response is not of this relying party.");
            }


            //checking CSRF_state
            var stateParams = new OpenID20.StateParams
            {
                client       = inputMSG.SVX_sender,
                idpPrincipal = idpParticipantId.principal
            };

            stateGenerator.Verify(stateParams, inputMSG.FieldsExpectedToBeSigned.theParams.CSRF_state);

            AuthConclusion.userProfile           = userProfile;
            AuthConclusion.userProfile.Authority = "Yahoo.com";
            return(AuthConclusion);
        }
Exemplo n.º 2
0
        public override OpenID20.AuthenticationRequest createAuthenticationRequest(SVX.Channel client)
        {
            AuthenticationRequest AuthenticationRequest = new AuthenticationRequest();

            AuthenticationRequest.openid__mode            = "checkid_setup";
            AuthenticationRequest.openid__identity        = "http://specs.openid.net/auth/2.0/identifier_select";
            AuthenticationRequest.openid__claimed_id      = "http://specs.openid.net/auth/2.0/identifier_select";
            AuthenticationRequest.openid__assoc_handle    = "blah_blah";
            AuthenticationRequest.openid__return_to       = return_to_uri;
            AuthenticationRequest.openid__ns__oauth       = "http://specs.openid.net/extensions/oauth/1.0";
            AuthenticationRequest.openid__oauth__consumer = Config.config.AppRegistration.Yahoo.clientID;

            // Yahoo doesn't seem to support OpenID extensions, so the next line is commented out
            //AuthenticationRequest.openid__sreg__required = "email,fullname";
            //AuthenticationRequest.openid__sreg__policy_url = "http://a.com/foo.html";

            AuthenticationRequest.openid__ns__ax             = "http://openid.net/srv/ax/1.0";
            AuthenticationRequest.openid__ax__mode           = "fetch_request";
            AuthenticationRequest.openid__ax__type__email    = "http://axschema.org/contact/email"; //"http://schema.openid.net/contact/email"; //
            AuthenticationRequest.openid__ax__type__fullname = "http://axschema.org/namePerson";
            AuthenticationRequest.openid__ax__required       = "email,fullname";

            var stateParams = new OpenID20.StateParams
            {
                client       = client,
                idpPrincipal = idpParticipantId.principal
            };

            AuthenticationRequest.CSRF_state = stateGenerator.Generate(stateParams, SVX_Principal);
            return(AuthenticationRequest);
        }