Exemplo n.º 1
0
        /*** implementing the methods for AuthenticationConclusion ***/
        public override GenericAuth.AuthenticationConclusion createConclusionOidc(
            OAuth20.AuthorizationResponse authorizationResponse,
            OIDC10.TokenResponse tokenResponse)
        {
            var AuthConclusion = new GenericAuth.AuthenticationConclusion();

            AuthConclusion.channel = authorizationResponse.SVX_sender;
            var        userProfile = new MSUserProfile();
            MSJwtToken jwtToken    = (MSJwtToken)tokenResponse.id_token.theParams;

            userProfile.Email = jwtToken.preferred_username;
            if (userProfile.Email == null)
            {
                userProfile.Email = jwtToken.unique_name;
            }
            if (userProfile.Email == null)
            {
                userProfile.Email = jwtToken.upn;
            }
            userProfile.MS_ID    = jwtToken.sub;
            userProfile.FullName = jwtToken.name;

            userProfile.UserID = userProfile.Email;

            AuthConclusion.userProfile           = userProfile;
            AuthConclusion.userProfile.Authority = "Microsoft.com";
            return(AuthConclusion);
        }
Exemplo n.º 2
0
        public override GenericAuth.AuthenticationConclusion createConclusion(
            OAuth20.AuthorizationResponse authorizationResponse,
            OAuth20.UserProfileResponse userProfileResponse)
        {
            var WBUserProfileResponse = (WBUserProfileResponse)userProfileResponse;
            var conclusion            = new GenericAuth.AuthenticationConclusion();

            conclusion.channel = authorizationResponse.SVX_sender;
            var UserProfile = new WBUserProfile();

            UserProfile.UserID               = WBUserProfileResponse.id;
            UserProfile.Email                = "";
            UserProfile.FullName             = WBUserProfileResponse.name;
            conclusion.userProfile           = UserProfile;
            conclusion.userProfile.Authority = "Weibo.com";
            return(conclusion);
        }
Exemplo n.º 3
0
        public override GenericAuth.AuthenticationConclusion createConclusion(
            OAuth20.AuthorizationResponse authorizationResponse,
            OAuth20.UserProfileResponse userProfileResponse)
        {
            var UserProfileResponse = (UserProfileResponse)userProfileResponse;
            var conclusion          = new GenericAuth.AuthenticationConclusion();

            conclusion.channel = authorizationResponse.SVX_sender;
            var UserProfile = new UserProfile();

            UserProfile.UserID               = UserProfileResponse.id;
            UserProfile.Email                = UserProfileResponse.emailAddress;
            UserProfile.FullName             = UserProfileResponse.firstName + " " + UserProfileResponse.lastName;
            conclusion.userProfile           = UserProfile;
            conclusion.userProfile.Authority = "LinkedIn.com";
            return(conclusion);
        }
Exemplo n.º 4
0
        /*** implementing the methods for AccessTokenRequest ***/
        public override OAuth20.AccessTokenRequest createAccessTokenRequest(OAuth20.AuthorizationResponse authorizationResponse)
        {
            var stateParams = new OAuth20.StateParams
            {
                client       = authorizationResponse.SVX_sender,
                idpPrincipal = idpParticipantId.principal
            };

            stateGenerator.Verify(stateParams, authorizationResponse.state);

            OAuth20.AccessTokenRequest _AccessTokenRequest = new OAuth20.AccessTokenRequest();
            _AccessTokenRequest.client_id     = client_id;
            _AccessTokenRequest.code          = authorizationResponse.code;
            _AccessTokenRequest.redirect_uri  = redirect_uri;
            _AccessTokenRequest.grant_type    = "authorization_code";
            _AccessTokenRequest.client_secret = client_secret;
            return(_AccessTokenRequest);
        }
Exemplo n.º 5
0
        public override GenericAuth.AuthenticationConclusion createConclusion(
            OAuth20.AuthorizationResponse authorizationResponse,
            OAuth20.UserProfileResponse userProfileResponse)
        {
            var fbUserProfileResponse = (FBUserProfileResponse)userProfileResponse;
            var conclusion            = new GenericAuth.AuthenticationConclusion();

            conclusion.channel = authorizationResponse.SVX_sender;
            var fbUserProfile = new FBUserProfile();

            fbUserProfile.UserID             = fbUserProfileResponse.id;
            fbUserProfile.Email              = fbUserProfileResponse.email;
            fbUserProfile.FB_ID              = fbUserProfileResponse.id;
            fbUserProfile.FullName           = fbUserProfileResponse.name;
            conclusion.userProfile           = fbUserProfile;
            conclusion.userProfile.Authority = "Facebook.com";
            return(conclusion);
        }
Exemplo n.º 6
0
        /*** implementing the methods for AccessTokenRequest ***/
        public override OAuth20.AccessTokenRequest createAccessTokenRequest(OAuth20.AuthorizationResponse authorizationResponse)
        {
            var stateParams = new OAuth20.StateParams
            {
                client       = authorizationResponse.SVX_sender,
                idpPrincipal = idpParticipantId.principal
            };

            stateGenerator.Verify(stateParams, authorizationResponse.state);

            OAuth20.AccessTokenRequest _AccessTokenRequest = new OAuth20.AccessTokenRequest();
            //Facebook's access token request doesn't need "grant_type=authorization_code".
            //See https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow
            _AccessTokenRequest.client_id     = client_id;
            _AccessTokenRequest.code          = authorizationResponse.code;
            _AccessTokenRequest.redirect_uri  = redirect_uri;
            _AccessTokenRequest.client_secret = client_secret;
            return(_AccessTokenRequest);
        }