-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from DSorlov/dev
Dev to Master v0.0.1
- Loading branch information
Showing
21 changed files
with
1,183 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Changelog for eid-provider-net | ||
|
||
The format is based on [Keep a Changelog][keep-a-changelog] | ||
<!-- and this project adheres to [Semantic Versioning][semantic-versioning]. --> | ||
|
||
## [Unreleased] | ||
- Nothing right now | ||
|
||
## [0.0.1] (2020-09-12) | ||
|
||
### Library | ||
- Initial release | ||
- Support for bankid, frejaeid and frejaorgid | ||
|
||
### Powershell | ||
- Initial release | ||
- Support for bankid, frejaeid and frejaorgid | ||
|
||
[keep-a-changelog]: http://keepachangelog.com/en/1.0.0/ | ||
[Unreleased]: https://github.com/DSorlov/eid-provider-net/compare/master...dev | ||
[0.0.1]: https://github.com/DSorlov/eid-provider-net/releases/tag/v0.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## BankID (bankid) | ||
|
||
### Description | ||
This module works directly with the BankID api. | ||
It is supplied with working testing credentials and basic production details. | ||
|
||
### Inputs and outputs | ||
|
||
**Extra fields on completion** | ||
* `autostart_token` the token used for autostart | ||
* `autostart_url` code for invoking authorization | ||
|
||
### Default Configuration | ||
>**Default production configuration (settings.production)** | ||
``` | ||
endpoint: 'https://appapi2.bankid.com/rp/v5', | ||
client_cert: '', | ||
ca_cert: 'builtin://certs/bankid_prod.ca', | ||
allowFingerprint: true, | ||
password: '' | ||
``` | ||
>**Default testing configuration (settings.testing)** | ||
``` | ||
endpoint: 'https://appapi2.test.bankid.com/rp/v5', | ||
client_cert: 'builtin://certs/bankid_test.pfx', | ||
ca_cert: 'builtin://certs/bankid_test.ca', | ||
allowFingerprint: true, | ||
password: 'qwerty123' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
## Examples | ||
|
||
Very simple examples. All methods are available in Async versions also and supporting IProgress for long running operations. | ||
|
||
### Simple C# example for frejaeid | ||
This is a very simple example of calling authentication via frejaeid for the ssn 200101011212 and when final results are in dump them out on the console. | ||
```csharp | ||
EIDClientInitializationData config = new frejaeid.InitializationData(EIDEnvironment.Testing); | ||
EIDClient client = new frejaeid.Client((frejaeid.InitializationData)config); | ||
EIDResult = client.AuthRequest("200101011212"); | ||
Console.WriteLine(EIDResult.ToString()); | ||
``` | ||
|
||
### Simple C# example for bankid | ||
This is a very simple example of calling authentication via bankid for the ssn 200101011212 and when final results are in dump them out on the console. | ||
```csharp | ||
EIDClientInitializationData config = new bankid.InitializationData(EIDEnvironment.Testing); | ||
EIDClient client = new bankid.Client((bankid.InitializationData)config); | ||
EIDResult = client.AuthRequest("200101011212"); | ||
Console.WriteLine(EIDResult.ToString()); | ||
``` | ||
|
||
### Simple C# example for frejaeid with event callback | ||
This is a very simple example of calling authentication via frejaeid for the ssn 200101011212 and when final results are in dump them out on the console and also listen to events while it is processing | ||
```csharp | ||
EIDClientInitializationData config = new frejaeid.InitializationData(EIDEnvironment.Testing); | ||
EIDClient client = new frejaeid.Client((frejaeid.InitializationData)config); | ||
|
||
//Attach a event listener | ||
client.RequestEvent = (e) => { Console.WriteLine(e.EIDResult.ToString(); }; | ||
|
||
EIDResult = client.AuthRequest("200101011212"); | ||
Console.WriteLine(EIDResult.ToString()); | ||
``` | ||
|
||
### Simple C# example configuring options in config | ||
This is a very simple example of calling authentication via frejaeid for the ssn 200101011212 and when final results are in dump them out on the console. | ||
```csharp | ||
EIDClientInitializationData config = new bankid.InitializationData(EIDEnvironment.Testing); | ||
config["client_cert"] = YourX509Certificate2(); | ||
|
||
EIDClient client = new bankid.Client((bankid.InitializationData)config); | ||
EIDResult = client.AuthRequest("200101011212"); | ||
Console.WriteLine(EIDResult.ToString()); | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
## Freja eID (frejaeid) | ||
|
||
### Description | ||
This module works directly with the Freja eID REST API and Freja eID Org ID REST API. | ||
It is supplied with working testing credentials and basic production details. | ||
|
||
This module exposes extra functions also (and async variants also): | ||
- **AddOrgIdRequest(string id, string title, string attribute, string value)** Creates a new orgidadd and returns after result is received | ||
- **InitAddOrgIdRequest(string id, string title, string attribute, string value)** Initiates orgidadd and returns a initialization object | ||
- **PollAddOrgIdResult(string id)** Checks the status of a orgidadd operation | ||
- **CancelAddOrgIdRequest(string id)** Cancels a pending orgidadd | ||
- **DeleteOrgId(string id)** Removes a orgid from an existing eid | ||
- **CreateCustomIdentifier(string id, string customid)** Creates a custom identifier for a specific eid | ||
- **DeleteCustomIdentifier(string customid)** Removes a custom identifier for a specific eid | ||
|
||
### Inputs and outputs | ||
|
||
**Extra fields on completion** | ||
* `autostart_token` the token used for autostart | ||
* `autostart_url` code for invoking authorization | ||
|
||
### Default Configuration | ||
attribute_list is a comma separated list of EMAIL_ADDRESS,RELYING_PARTY_USER_ID,BASIC_USER_INFO,SSN,ADDRESSES,DATE_OF_BIRTH,ALL_EMAIL_ADDRESSES | ||
minimum_level is one of BASIC,EXTENDED,PLUS | ||
id_type is one of SSN,EMAIL,PHONE | ||
>**Default production configuration (settings.production)** | ||
``` | ||
endpoint: 'https://services.prod.frejaeid.com', | ||
client_cert: '', | ||
ca_cert: 'builtin://certs/frejaeid_prod.ca', | ||
jwt_cert: { | ||
'aRw9OLn2BhM7hxoc458cIXHfezw': 'builtin://certs/frejaeid_prod_aRw9OLn2BhM7hxoc458cIXHfezw.jwt'), | ||
'onjnxVgI3oUzWQMLciD7sQZ4mqM': 'builtin://certs/frejaeid_prod_onjnxVgI3oUzWQMLciD7sQZ4mqM.jwt') | ||
}, | ||
minimum_level: 'EXTENDED', | ||
password: '', | ||
default_country: 'SE', | ||
id_type: 'SSN', | ||
attribute_list: 'EMAIL_ADDRESS,RELYING_PARTY_USER_ID,BASIC_USER_INFO' | ||
``` | ||
>**Default testing configuration (settings.testing)** | ||
``` | ||
endpoint: 'https://services.test.frejaeid.com', | ||
client_cert: 'builtin://certs/frejaeid_test.ca', | ||
ca_cert: 'builtin://certs/frejaeid_test.pfx', | ||
jwt_cert: { | ||
'2LQIrINOzwWAVDhoYybqUcXXmVs': 'builtin://certs/frejaeid_test_2LQIrINOzwWAVDhoYybqUcXXmVs.jwt'), | ||
'HwMHK_gb3_iuNF1advMtlG0-fUs': 'builtin://certs/frejaeid_test_HwMHK_gb3_iuNF1advMtlG0-fUs.jwt') | ||
}, | ||
minimum_evel: 'EXTENDED', | ||
password: 'test', | ||
default_country: 'SE', | ||
id_type: 'SSN', | ||
attribute_list: 'EMAIL_ADDRESS,RELYING_PARTY_USER_ID,BASIC_USER_INFO' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
## Methods | ||
|
||
This is the general description of the methods availiable to you. | ||
I'm still struggling a bit to make this really readable in a good way, so perhaps easier to check with the [examples](examples.md). | ||
This as close a replication of the original library as possible, it is using language specific features and sports some nice taskbased interfaces. | ||
|
||
### constructor(initialization data) | ||
|
||
Configures the module according to the object sent in. | ||
Example configs can be obtained by accessing the `settings` properties of each module. | ||
|
||
>**Inputs** | ||
object(mandatory): A object containing configuration. | ||
|
||
>**Outputs** | ||
None | ||
|
||
### PollAuthStatus(string) or PollSignStatus(string) | ||
|
||
>**Inputs** | ||
string(mandatory): A string containing the id of the authentication or signing you wish to check | ||
|
||
>**Outputs** | ||
A status object as one of the below: | ||
|
||
```javascript | ||
{ | ||
status: 'error' or 'pending', | ||
code: string, | ||
description: string, | ||
[details: string] | ||
} | ||
``` | ||
|
||
The description field is a user friendly error message in english. The details is a optional field that if it exists contains more information about the error. More generic error types often have a details field. | ||
|
||
| Status | Possible Codes | | ||
| --- | --- | | ||
| error | system_error<br/>request_id_invalid<br/>api_error<br/>expired_transaction<br/>cancelled_by_user<br/>cancelled_by_idp | | ||
| pending | pending_notdelivered<br/>pending_user_in_app<br/>pending_delivered | | ||
|
||
```javascript | ||
{ | ||
status: 'completed', | ||
user: { | ||
firstname: string, | ||
lastname: string, | ||
fullname: string, | ||
ssn: string | ||
}, | ||
extra: {..} | ||
} | ||
``` | ||
|
||
When the status is completed extra information may be in the extra block depending on which module you are using. | ||
|
||
### Task AuthRequest(string, ProcessIProgress<EIDResult>, CancellationToken) or Task SignRequest(string, string, ProcessIProgress<EIDResult>, CancellationToken) | ||
|
||
>**Inputs** | ||
string: this is the ssn most probably put could be a object with special properties for that module. | ||
ProcessIProgress<EIDResult>: A ProcessIProgress to report back events and updates as they unfold | ||
CancellationToken: Standard CancellationToken to cancel the running task | ||
|
||
>**Outputs** | ||
Same as PollAuthStatus(string) or PollSignStatus(string) but wrapped in a awaitable Task | ||
|
||
### InitAuthRequest(string) or InitSignRequest(string,string) | ||
|
||
>**Inputs** | ||
string(mandatory): this is the ssn most probably put could be a object with special properties for that module. | ||
string(only for signing): this is the text most probably put could be a object with special properties for that module. | ||
|
||
>**Outputs** | ||
A status object as one of the below: | ||
|
||
```javascript | ||
{ | ||
status: 'error', | ||
code: string, | ||
description: string, | ||
[details: string] | ||
} | ||
``` | ||
|
||
The description field is a user friendly error message in english. The details is a optional field that if it exists contains more information about the error. More generic error types often have a details field. | ||
|
||
| Status | Possible Codes | | ||
| --- | --- | | ||
| error | system_error<br/>already_in_progress<br/>request_ssn_invalid<br/>request_text_invalid<br/>api_error | | ||
|
||
```javascript | ||
{ | ||
status: 'initialized', | ||
id: string, | ||
description: string, | ||
extra: {..} | ||
} | ||
``` | ||
|
||
When the status is completed extra information may be in the extra block depending on which module you are using. | ||
|
||
### CancelAuthRequest(string) or CancelSignRequest(string) | ||
|
||
>**Inputs** | ||
string(mandatory): A string containing the id of the authentication or signing you wish to cancel | ||
|
||
>**Outputs** | ||
```javascript | ||
{ | ||
status: 'cancelled', | ||
id: string, | ||
description: string, | ||
extra: {..} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## Powershell Examples | ||
|
||
Very simple examples. | ||
|
||
### Simple power example for frejaeid | ||
This is a very simple example of calling authentication via frejaeid for the ssn 200101011212 and print the results console. | ||
|
||
```powershell | ||
$config = Get-EIDConfig frejaeid -Enviroment Testing | ||
Request-EIDOperation $config -Type auth -Id 200101011212 -Wait | ||
``` | ||
|
||
### Simple powershell example for bankid | ||
This is a very simple example of calling authentication via frejaeid for the ssn 200101011212 and print the results console. | ||
|
||
```powershell | ||
$config = Get-EIDConfig bankid -Enviroment Testing | ||
Request-EIDOperation $config -Type auth -Id 200101011212 -Wait | ||
``` | ||
|
||
### Add an organizational id to a existing eid via freja eid orgid | ||
This is a very simple example of calling authentication via frejaeid for the ssn 200101011212 and print the results console. | ||
|
||
```powershell | ||
$config = Get-EIDConfig frejaeid -Enviroment Testing | ||
Start-EIDRequest $s -Type orgid -Id 200101011212 -Title "Corp Id" -Attribute "Employee #" -Value "123456" -Wait | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.