001package org.hl7.fhir.r4.model.codesystems;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jan 30, 2019 16:19-0500 for FHIR v4.0.0
033
034import org.hl7.fhir.exceptions.FHIRException;
035
036public enum RestfulSecurityService {
037
038  /**
039   * OAuth (unspecified version see oauth.net).
040   */
041  OAUTH,
042  /**
043   * OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org/).
044   */
045  SMARTONFHIR,
046  /**
047   * Microsoft NTLM Authentication.
048   */
049  NTLM,
050  /**
051   * Basic authentication defined in HTTP specification.
052   */
053  BASIC,
054  /**
055   * see http://www.ietf.org/rfc/rfc4120.txt.
056   */
057  KERBEROS,
058  /**
059   * SSL where client must have a certificate registered with the server.
060   */
061  CERTIFICATES,
062  /**
063   * added to help the parsers
064   */
065  NULL;
066
067  public static RestfulSecurityService fromCode(String codeString) throws FHIRException {
068    if (codeString == null || "".equals(codeString))
069      return null;
070    if ("OAuth".equals(codeString))
071      return OAUTH;
072    if ("SMART-on-FHIR".equals(codeString))
073      return SMARTONFHIR;
074    if ("NTLM".equals(codeString))
075      return NTLM;
076    if ("Basic".equals(codeString))
077      return BASIC;
078    if ("Kerberos".equals(codeString))
079      return KERBEROS;
080    if ("Certificates".equals(codeString))
081      return CERTIFICATES;
082    throw new FHIRException("Unknown RestfulSecurityService code '" + codeString + "'");
083  }
084
085  public String toCode() {
086    switch (this) {
087    case OAUTH:
088      return "OAuth";
089    case SMARTONFHIR:
090      return "SMART-on-FHIR";
091    case NTLM:
092      return "NTLM";
093    case BASIC:
094      return "Basic";
095    case KERBEROS:
096      return "Kerberos";
097    case CERTIFICATES:
098      return "Certificates";
099    case NULL:
100      return null;
101    default:
102      return "?";
103    }
104  }
105
106  public String getSystem() {
107    return "http://terminology.hl7.org/CodeSystem/restful-security-service";
108  }
109
110  public String getDefinition() {
111    switch (this) {
112    case OAUTH:
113      return "OAuth (unspecified version see oauth.net).";
114    case SMARTONFHIR:
115      return "OAuth2 using SMART-on-FHIR profile (see http://docs.smarthealthit.org/).";
116    case NTLM:
117      return "Microsoft NTLM Authentication.";
118    case BASIC:
119      return "Basic authentication defined in HTTP specification.";
120    case KERBEROS:
121      return "see http://www.ietf.org/rfc/rfc4120.txt.";
122    case CERTIFICATES:
123      return "SSL where client must have a certificate registered with the server.";
124    case NULL:
125      return null;
126    default:
127      return "?";
128    }
129  }
130
131  public String getDisplay() {
132    switch (this) {
133    case OAUTH:
134      return "OAuth";
135    case SMARTONFHIR:
136      return "SMART-on-FHIR";
137    case NTLM:
138      return "NTLM";
139    case BASIC:
140      return "Basic";
141    case KERBEROS:
142      return "Kerberos";
143    case CERTIFICATES:
144      return "Certificates";
145    case NULL:
146      return null;
147    default:
148      return "?";
149    }
150  }
151
152}