README.md

# Überauth IDAustria

Provides an Ueberauth strategy for authenticating with ID Austria (the austrian eIDAS implementation).
See the [eIDAS Regulation](https://digital-strategy.ec.europa.eu/en/policies/eidas-regulation) for infos about eIDAS.

## Installation

**Prerequisite:** You have to be an registered service with the ID Austria system.
 Information about registering can be obtained [from the EGIZ](https://eid.egiz.gv.at/anbindung/registrierung/).

1. Add `ueberauth_id_austria` to your list of dependencies in `mix.exs`:

   ```elixir
   def deps do
     [
       {:ueberauth_id_austria, "~> 0.1.0"}
     ]
   end
   ```

2. Add ID Austria to your Überauth configuration:

   ```elixir
   config :ueberauth, Ueberauth,
     providers: [
       eid: {Ueberauth.Strategy.IdAustria, []}
     ]
   ```

3. Add the provider configuration:

   ```elixir
   config :ueberauth, Ueberauth.Strategy.IdAustria.OAuth,
     client_id: System.get_env("EID_CLIENT_ID"),
     client_secret: System.get_env("EID_CLIENT_SECRET")
   ```

4. Setup your auth controller with the Überauth plug:

   ```elixir
    defmodule MyApp.AuthController do
      use MyApp.Web, :controller
      plug Ueberauth

      ...
    end
   ```

5. Setup the routes:

   ```elixir
    scope "/auth", MyApp do
      pipe_through :browser

      get "/:provider", AuthController, :request
      get "/:provider/callback", AuthController, :callback
    end
   ```

6. Your controller needs to implement callbacks to deal with `Ueberauth.Auth`
   and `Ueberauth.Failure` responses.

## Development/Test-System

The `Ueberauth.Strategy.IdAustria.OAuth` module differentiates between `:prod`
and other environments. For `:prod` the productive `eid.oesterreich.gv.at`
endpoint is used.

Otherwise the test endpoint `eid2.oesterreich.gv.at` is used.
There are predefined test identities that can be used via this endpoint. A list
and description is available at [the EGIZ homepage](https://eid.egiz.gv.at/anbindung/testidentitaeten/vordefinierte-testidentitaeten/).

To enable testing mode you have to include the following in your configuration:

```elixir
config :ueberauth_id_austria, :prod, false
```