GET | /nemidvalidatelogin |
---|
import Foundation
import ServiceStack
public class ValidateNemIdRequestModel : Codable
{
required public init(){}
}
public class NemIDFlowResult : FlowResult
{
public var authenticationInfo:AuthenticationInfo?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case authenticationInfo
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
authenticationInfo = try container.decodeIfPresent(AuthenticationInfo.self, forKey: .authenticationInfo)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if authenticationInfo != nil { try container.encode(authenticationInfo, forKey: .authenticationInfo) }
}
}
public class FlowResult : FlowMessage
{
public var clientFlow:ClientFlow?
public var status:FlowStatus?
public var isSuccess:Bool?
public var message:String?
public var userMessage:String?
public var flowErrorCode:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case clientFlow
case status
case isSuccess
case message
case userMessage
case flowErrorCode
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
clientFlow = try container.decodeIfPresent(ClientFlow.self, forKey: .clientFlow)
status = try container.decodeIfPresent(FlowStatus.self, forKey: .status)
isSuccess = try container.decodeIfPresent(Bool.self, forKey: .isSuccess)
message = try container.decodeIfPresent(String.self, forKey: .message)
userMessage = try container.decodeIfPresent(String.self, forKey: .userMessage)
flowErrorCode = try container.decodeIfPresent(String.self, forKey: .flowErrorCode)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if clientFlow != nil { try container.encode(clientFlow, forKey: .clientFlow) }
if status != nil { try container.encode(status, forKey: .status) }
if isSuccess != nil { try container.encode(isSuccess, forKey: .isSuccess) }
if message != nil { try container.encode(message, forKey: .message) }
if userMessage != nil { try container.encode(userMessage, forKey: .userMessage) }
if flowErrorCode != nil { try container.encode(flowErrorCode, forKey: .flowErrorCode) }
}
}
public class FlowMessage : Body
{
public var timestamp:String?
public var transactionIdentifier:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case timestamp
case transactionIdentifier
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
timestamp = try container.decodeIfPresent(String.self, forKey: .timestamp)
transactionIdentifier = try container.decodeIfPresent(String.self, forKey: .transactionIdentifier)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if timestamp != nil { try container.encode(timestamp, forKey: .timestamp) }
if transactionIdentifier != nil { try container.encode(transactionIdentifier, forKey: .transactionIdentifier) }
}
}
public class Body : Codable
{
required public init(){}
}
public enum ClientFlow : String, Codable
{
case NemID
case NemIDSignature
case NemIDKeyFile
case NemIDKeyFileSignature
case NL3Signature
case Invalid
case LoadTest
}
public enum FlowStatus : String, Codable
{
case Ok
case UserCancel
case ClientFlowError
case FlowError
case ValidationError
}
public class AuthenticationInfo : Codable
{
public var pid:String?
public var dn:String?
public var commonName:String?
public var rid:String?
public var cpr:String?
public var cvr:String?
public var company:String?
public var email:String?
public var signedXml:String?
public var issuerDn:String?
public var isYouthCert:Bool?
public var certificateType:CertificateType?
public var subjectSerialNumber:String?
public var signProperties:IList<SignProperty>?
public var rememberUserIdToken:String?
public var logonType:LogonType?
public var certificateSerialNumber:String?
public var clientCertificate:[UInt8] = []
public var authorizedToRepresent:String?
required public init(){}
}
public enum CertificateType : String, Codable
{
case Poces
case Moces
case Voces
case Foces
}
public class SignProperty : Codable
{
public var name:String?
public var value:String?
required public init(){}
}
public enum LogonType : String, Codable
{
case Otp
case KeyFile
case Unknown
}
Swift ValidateNemIdRequestModel DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /nemidvalidatelogin HTTP/1.1 Host: hcbtas-q-albamfs-api.azurewebsites.net Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <NemIDFlowResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame.NemID"> <Timestamp xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">String</Timestamp> <TransactionIdentifier xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">String</TransactionIdentifier> <ClientFlow xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">NemID</ClientFlow> <FlowErrorCode xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">String</FlowErrorCode> <Message xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">String</Message> <Status xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">Ok</Status> <UserMessage xmlns="http://schemas.datacontract.org/2004/07/SPS.Core.Api.Frame">String</UserMessage> <AuthenticationInfo> <AuthorizedToRepresent>String</AuthorizedToRepresent> <CertificateSerialNumber>String</CertificateSerialNumber> <CertificateType>Poces</CertificateType> <ClientCertificate>AA==</ClientCertificate> <CommonName>String</CommonName> <Company>String</Company> <Cpr>String</Cpr> <Cvr>String</Cvr> <Dn>String</Dn> <Email>String</Email> <IsYouthCert>false</IsYouthCert> <IssuerDn>String</IssuerDn> <LogonType>Otp</LogonType> <Pid>String</Pid> <RememberUserIdToken>String</RememberUserIdToken> <Rid>String</Rid> <SignProperties i:nil="true" /> <SignedXml>String</SignedXml> <SubjectSerialNumber>String</SubjectSerialNumber> </AuthenticationInfo> </NemIDFlowResult>