Logging in to website through ADFS with K6 script

Hello K6 community.

We are trying to setup K6 for load testing our website that is behind ADFS login.
The trouble is that the K6 Recorder captures the login correctly, but it will not work when scripted out.

The ADFS login does some automagic postback during login, and the hidden values that it sets, we are unable to retrieve.
In our old webtests, the client could capture the hidden values on the postback.

> <FormPostHttpBody>
> <FormPostParameter Name="__VIEWSTATE" Value="{{$HIDDEN1.__VIEWSTATE}}" RecordedValue="/wEPDwUKMTQ0MDU2NDgwMmRk" CorrelationBinding="" UrlEncode="True" />
> <FormPostParameter Name="__EVENTVALIDATION" Value="{{$HIDDEN1.__EVENTVALIDATION}}" RecordedValue="/wEWBQKSwNnNDgLnmcnFAQKzpa6MBwKo77JuAunYybIM" CorrelationBinding="" UrlEncode="True" />
> <FormPostParameter Name="__db" Value="{{$HIDDEN1.__db}}" RecordedValue="14" CorrelationBinding="" UrlEncode="True" />
> <FormPostParameter Name="ctl00$ContentPlaceHolder1$UsernameTextBox" Value="{{Studenter.Row.S_IDENT}}" RecordedValue="student_id" CorrelationBinding="" UrlEncode="True" />
> <FormPostParameter Name="ctl00$ContentPlaceHolder1$PasswordTextBox" Value="{{Studenter.Row.PASSORD}}" RecordedValue="student_password" CorrelationBinding="" UrlEncode="True" />
> <FormPostParameter Name="ctl00$ContentPlaceHolder1$SubmitButton" Value="Sign In" RecordedValue="Sign In" CorrelationBinding="{{FormPostParam1.ctl00$ContentPlaceHolder1$SubmitButton}}" UrlEncode="True" />
> </FormPostHttpBody>

The question is if anyone have any experience in logging in with ADFS and could point us in the right direction to manage to script the login through ADFS?

1 Like

I haven’t used ADFS, but why are you unable to retrieve these “hidden values” with k6? Can’t you extract them from the Response object of the request? Maybe by using the k6/html API to parse the body and extract these FormPostParameter attributes?

Still looking for someone who has done this with ADFS.
The response object doesn’t contain the values needed, and have tried the Response.submitForm( [params] ) method in K6.

1 Like