예제 #1
0
        public virtual TokenResponse SVX_MakeTokenResponse(AccessTokenRequest req, AuthorizationCodeParams codeParamsHint)
        {
            // We should only get here with req.grant_type ==
            // "authorization_code", so we don't have to worry about modeling
            // what IdP does in any other case.
            if (req.grant_type != "authorization_code")
            {
                return(VProgram_API.Nondet <TokenResponse>());
            }

            authorizationCodeGenerator.Verify(codeParamsHint, req.code);

            if (req.redirect_uri != codeParamsHint.redirect_uri)
            {
                throw new Exception("Authorization code RP mismatch");
            }

            var JwtTokenBody = MakeJwtTokenBody(req.client_id, codeParamsHint.userID);

            SVX.PayloadSecret <JwtTokenBody> id_token1 = getTokenGenerator().Generate(JwtTokenBody, SVX_Principal);
            TokenResponse TokenResponse = new TokenResponse
            {
                id_token = id_token1,
            };

            return(TokenResponse);
        }
예제 #2
0
        public AuthenticationResponse SVX_MakeAuthenticationResponse(AuthenticationRequest req, IdPAuthenticationEntry idpConc)
        {
            var SignedFieldsParams = SVX_Ops.Call(SVX_MakeSignedFields, req, idpConc);

            SVX.PayloadSecret <FieldsExpectedToBeSigned> SignedFields = getSignedFieldsGenerator().Generate(SignedFieldsParams, SVX_Principal);
            return(new AuthenticationResponse
            {
                openid__op_endpoint = SVX.VProgram_API.Nondet <String>(),
                openid__response_nonce = SVX.VProgram_API.Nondet <String>(),
                FieldsExpectedToBeSigned = SignedFields
            });
        }
예제 #3
0
        public AuthenticationResponse_with_id_token SVX_MakeAuthorizationResponse_with_id_token(AuthorizationRequest req, IdPAuthenticationEntry idpConc)
        {
            var JwtTokenBody = SVX_Ops.Call(SVX_MakeJwtTokenBody, req, idpConc);

            SVX.PayloadSecret <JwtTokenBody>     id_token1 = getTokenGenerator().Generate(JwtTokenBody, SVX_Principal);
            AuthenticationResponse_with_id_token AuthenticationResponse_with_id_token = new AuthenticationResponse_with_id_token
            {
                access_token = SVX.VProgram_API.Nondet <String>(),
                id_token     = id_token1,
                state        = req.state
            };

            return(AuthenticationResponse_with_id_token);
        }