gluu
公開メンバ関数 | 静的公開変数類 | 非公開メンバ関数 | 全メンバ一覧
org.xdi.oxauth.dev.duo.PythonToLdapString クラス
org.xdi.oxauth.dev.duo.PythonToLdapString 連携図
Collaboration graph

公開メンバ関数

void test () throws IOException
 

静的公開変数類

static final String SCRIPT_FIELD_NAME = "script.__$__customAuthenticationScript__$__"
 

非公開メンバ関数

CustomProperty createAttribute (String p_name, String p_value)
 
String getJSONString (oxIDPAuthConf conf) throws IOException
 
oxIDPAuthConf fromJSON (String p_json) throws IOException
 

詳解

著者
Yuriy Zabrovarnyy
バージョン
0.9, 28/12/2012

関数詳解

◆ createAttribute()

CustomProperty org.xdi.oxauth.dev.duo.PythonToLdapString.createAttribute ( String  p_name,
String  p_value 
)
inlineprivate
80  {
81  final List<String> v = new ArrayList<String>();
82  v.add(p_value);
83 
84  final CustomProperty result = new CustomProperty();
85  result.setName(p_name);
86  result.setValues(v);
87  return result;
88  }

◆ fromJSON()

oxIDPAuthConf org.xdi.oxauth.dev.duo.PythonToLdapString.fromJSON ( String  p_json) throws IOException
inlineprivate
97  {
98  ObjectMapper mapper = new ObjectMapper();
99  return mapper.readValue(p_json, oxIDPAuthConf.class);
100  }

◆ getJSONString()

String org.xdi.oxauth.dev.duo.PythonToLdapString.getJSONString ( oxIDPAuthConf  conf) throws IOException
inlineprivate
90  {
91  StringWriter sw = new StringWriter();
92  ObjectMapper mapper = new ObjectMapper();
93  mapper.writeValue(sw, conf);
94  return sw.toString();
95  }

◆ test()

void org.xdi.oxauth.dev.duo.PythonToLdapString.test ( ) throws IOException
inline
49  {
50  final File f = new File("U:\\own\\project\\oxAuth\\Server\\integrations\\duo\\ExternalAuthenticator.py");
51  final String pythonScript = IOUtils.toString(new FileInputStream(f));
52  System.out.println("Python script: \n" + pythonScript);
53 
54  final List<CustomProperty> fields = new ArrayList<CustomProperty>();
55  fields.add(createAttribute("property.duo_host", "api-fa928e64.duosecurity.com"));
56  fields.add(createAttribute("property.duo_ikey", "DIT2906CETIMKHE1QND8"));
57  fields.add(createAttribute("property.duo_skey", "cjNn9R4QvQV0R2Mynw2CauCUesojuR3cPGDoVygM"));
58  fields.add(createAttribute("property.duo_akey", "6f88ca3dea7ac88a514cdef7c18021678ccaf0e1"));
59  fields.add(createAttribute(SCRIPT_FIELD_NAME, pythonScript));
60 
61  final oxIDPAuthConf c = new oxIDPAuthConf();
62  c.setType("customAuthentication");
63  c.setName("duo");
64  c.setEnabled(true);
65  c.setLevel(1);
66  c.setPriority(1);
67  c.setFields(fields);
68 
69  final String json = getJSONString(c);
70  System.out.println("JSON: \n" + json);
71 
72  final oxIDPAuthConf fromJson = fromJSON(json);
73  for (CustomProperty attr : fromJson.getFields()) {
74  if (attr.getName().equals(SCRIPT_FIELD_NAME)) {
75  System.out.println("Script from json: \n" + attr.getValues().get(0));
76  }
77  }
78  }
static final String SCRIPT_FIELD_NAME
Definition: PythonToLdapString.java:28
oxIDPAuthConf fromJSON(String p_json)
Definition: PythonToLdapString.java:97
String getJSONString(oxIDPAuthConf conf)
Definition: PythonToLdapString.java:90
CustomProperty createAttribute(String p_name, String p_value)
Definition: PythonToLdapString.java:80

メンバ詳解

◆ SCRIPT_FIELD_NAME

final String org.xdi.oxauth.dev.duo.PythonToLdapString.SCRIPT_FIELD_NAME = "script.__$__customAuthenticationScript__$__"
static

このクラス詳解は次のファイルから抽出されました: