Consider a matrix $$ \begin{bmatrix} a & b \\ c & d \end{bmatrix} $$ You can easily work out the characteristic polynomial, which is $$ X^2 - (a+d)X + (ad-bc) $$ Based on your information, you have $$ \begin{cases} a+d=1 \\ ad-bc=0 \end{cases} $$ because in a polynomial $X^2+pX+q$ the sum of the roots is $-p$ and their product is $q$.

This gives $d=1-a$, so $a-a^2-bc=0$ or $bc=a-a^2$. You can thus choose arbitrarily $a$. If $a=0$ or $a=1$, then one among $b$ and $c$ must be zero and the other one is arbitrary. For $a-a^2\ne0$, the matrices you look for have the form $$ \begin{bmatrix} a & b \\ \dfrac{a-a^2}{b} & 1-a \end{bmatrix} $$ So the general form is one of these five cases

  1. $\begin{bmatrix}0 & b \\ 0 & 1\end{bmatrix}\quad$ (arbitrary $b$)

  2. $\begin{bmatrix}0 & 0 \\ c & 1\end{bmatrix}\quad$ (arbitrary $c$)

  3. $\begin{bmatrix}1 & b \\ 0 & 0\end{bmatrix}\quad$ (arbitrary $b$)

  4. $\begin{bmatrix}1 & 0 \\ c & 0\end{bmatrix}\quad$ (arbitrary $c$)

  5. $\begin{bmatrix} a & b \\ \dfrac{a-a^2}{b} & 1-a \end{bmatrix}\quad$ ($a\ne0$, $a\ne1$, $b\ne0$)


Since the eigenvalues are 0 and 1 (hence distinct), the matrix must be diagonalizable. Thus it must be of the form $P^{-1}\begin{pmatrix} 1 & 0 \\ 0 & 0 \end{pmatrix}P$ for some invertible matrix $P$. Since there is a nice explicit formula for the inverse of a $2 \times 2$ matrix, you can work out the form of any matrix of the aforementioned form. Take $P = \begin{pmatrix} a & b \\ c & d \end{pmatrix}$, where $\det P = ad-bc \ne 0$, then write out $P^{-1}$, and then compute.

EDIT: I am assuming you mean that the set of eignevalues of your matrix must be $\{0,1\}$, as opposed to being contained in this set, which is what Sharkos assumes. So it depends on what you intended.