mitreid-connect
公開メンバ関数 | 静的公開変数類 | 非公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.mitre.openid.connect.web.BlacklistAPI クラス
org.mitre.openid.connect.web.BlacklistAPI 連携図
Collaboration graph

公開メンバ関数

String getAllBlacklistedSites (ModelMap m)
 
String addNewBlacklistedSite (@RequestBody String jsonString, ModelMap m, Principal p)
 
String updateBlacklistedSite (@PathVariable("id") Long id, @RequestBody String jsonString, ModelMap m, Principal p)
 
String deleteBlacklistedSite (@PathVariable("id") Long id, ModelMap m)
 
String getBlacklistedSite (@PathVariable("id") Long id, ModelMap m)
 

静的公開変数類

static final String URL = RootController.API_URL + "/blacklist"
 

非公開変数類

BlacklistedSiteService blacklistService
 
Gson gson = new Gson()
 
JsonParser parser = new JsonParser()
 

静的非公開変数類

static final Logger logger = LoggerFactory.getLogger(BlacklistAPI.class)
 

詳解

著者
jricher

関数詳解

◆ addNewBlacklistedSite()

String org.mitre.openid.connect.web.BlacklistAPI.addNewBlacklistedSite ( @RequestBody String  jsonString,
ModelMap  m,
Principal  p 
)
inline

Create a new blacklisted site

引数
jsonString
m
p
戻り値
94  {
95 
96  JsonObject json;
97 
98  BlacklistedSite blacklist = null;
99 
100  try {
101 
102  json = parser.parse(jsonString).getAsJsonObject();
103  blacklist = gson.fromJson(json, BlacklistedSite.class);
104  BlacklistedSite newBlacklist = blacklistService.saveNew(blacklist);
105  m.put(JsonEntityView.ENTITY, newBlacklist);
106 
107  }
108  catch (JsonSyntaxException e) {
109  logger.error("addNewBlacklistedSite failed due to JsonSyntaxException: ", e);
110  m.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
111  m.put(JsonErrorView.ERROR_MESSAGE, "Could not save new blacklisted site. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
112  return JsonErrorView.VIEWNAME;
113  } catch (IllegalStateException e) {
114  logger.error("addNewBlacklistedSite failed due to IllegalStateException", e);
115  m.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
116  m.put(JsonErrorView.ERROR_MESSAGE, "Could not save new blacklisted site. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
117  return JsonErrorView.VIEWNAME;
118  }
119 
120  return JsonEntityView.VIEWNAME;
121 
122  }
static final Logger logger
Definition: BlacklistAPI.java:66
BlacklistedSite saveNew(BlacklistedSite blacklistedSite)
Gson gson
Definition: BlacklistAPI.java:68
BlacklistedSiteService blacklistService
Definition: BlacklistAPI.java:61
JsonParser parser
Definition: BlacklistAPI.java:69

◆ deleteBlacklistedSite()

String org.mitre.openid.connect.web.BlacklistAPI.deleteBlacklistedSite ( @PathVariable("id") Long  id,
ModelMap  m 
)
inline

Delete a blacklisted site

175  {
176  BlacklistedSite blacklist = blacklistService.getById(id);
177 
178  if (blacklist == null) {
179  logger.error("deleteBlacklistedSite failed; blacklist with id " + id + " could not be found");
180  m.put(JsonErrorView.ERROR_MESSAGE, "Could not delete bladklist. The requested bladklist with id " + id + " could not be found.");
181  return JsonErrorView.VIEWNAME;
182  } else {
183  m.put(HttpCodeView.CODE, HttpStatus.OK);
184  blacklistService.remove(blacklist);
185  }
186 
187  return HttpCodeView.VIEWNAME;
188  }
void remove(BlacklistedSite blacklistedSite)
static final Logger logger
Definition: BlacklistAPI.java:66
BlacklistedSiteService blacklistService
Definition: BlacklistAPI.java:61

◆ getAllBlacklistedSites()

String org.mitre.openid.connect.web.BlacklistAPI.getAllBlacklistedSites ( ModelMap  m)
inline

Get a list of all blacklisted sites

引数
m
戻り値
77  {
78 
79  Collection<BlacklistedSite> all = blacklistService.getAll();
80 
81  m.put(JsonEntityView.ENTITY, all);
82 
83  return JsonEntityView.VIEWNAME;
84  }
BlacklistedSiteService blacklistService
Definition: BlacklistAPI.java:61

◆ getBlacklistedSite()

String org.mitre.openid.connect.web.BlacklistAPI.getBlacklistedSite ( @PathVariable("id") Long  id,
ModelMap  m 
)
inline

Get a single blacklisted site

194  {
195  BlacklistedSite blacklist = blacklistService.getById(id);
196  if (blacklist == null) {
197  logger.error("getBlacklistedSite failed; blacklist with id " + id + " could not be found");
198  m.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
199  m.put(JsonErrorView.ERROR_MESSAGE, "Could not delete bladklist. The requested bladklist with id " + id + " could not be found.");
200  return JsonErrorView.VIEWNAME;
201  } else {
202 
203  m.put(JsonEntityView.ENTITY, blacklist);
204 
205  return JsonEntityView.VIEWNAME;
206  }
207 
208  }
static final Logger logger
Definition: BlacklistAPI.java:66
BlacklistedSiteService blacklistService
Definition: BlacklistAPI.java:61

◆ updateBlacklistedSite()

String org.mitre.openid.connect.web.BlacklistAPI.updateBlacklistedSite ( @PathVariable("id") Long  id,
@RequestBody String  jsonString,
ModelMap  m,
Principal  p 
)
inline

Update an existing blacklisted site

128  {
129 
130  JsonObject json;
131 
132  BlacklistedSite blacklist = null;
133 
134  try {
135 
136  json = parser.parse(jsonString).getAsJsonObject();
137  blacklist = gson.fromJson(json, BlacklistedSite.class);
138 
139  }
140  catch (JsonSyntaxException e) {
141  logger.error("updateBlacklistedSite failed due to JsonSyntaxException", e);
142  m.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
143  m.put(JsonErrorView.ERROR_MESSAGE, "Could not update blacklisted site. The server encountered a JSON syntax exception. Contact a system administrator for assistance.");
144  return JsonErrorView.VIEWNAME;
145  } catch (IllegalStateException e) {
146  logger.error("updateBlacklistedSite failed due to IllegalStateException", e);
147  m.put(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
148  m.put(JsonErrorView.ERROR_MESSAGE, "Could not update blacklisted site. The server encountered an IllegalStateException. Refresh and try again - if the problem persists, contact a system administrator for assistance.");
149  return JsonErrorView.VIEWNAME;
150  }
151 
152 
153  BlacklistedSite oldBlacklist = blacklistService.getById(id);
154 
155  if (oldBlacklist == null) {
156  logger.error("updateBlacklistedSite failed; blacklist with id " + id + " could not be found");
157  m.put(HttpCodeView.CODE, HttpStatus.NOT_FOUND);
158  m.put(JsonErrorView.ERROR_MESSAGE, "Could not update blacklisted site. The requested blacklist with id " + id + "could not be found.");
159  return JsonErrorView.VIEWNAME;
160  } else {
161 
162  BlacklistedSite newBlacklist = blacklistService.update(oldBlacklist, blacklist);
163 
164  m.put(JsonEntityView.ENTITY, newBlacklist);
165 
166  return JsonEntityView.VIEWNAME;
167  }
168  }
static final Logger logger
Definition: BlacklistAPI.java:66
Gson gson
Definition: BlacklistAPI.java:68
BlacklistedSite update(BlacklistedSite oldBlacklistedSite, BlacklistedSite blacklistedSite)
BlacklistedSiteService blacklistService
Definition: BlacklistAPI.java:61
JsonParser parser
Definition: BlacklistAPI.java:69

メンバ詳解

◆ blacklistService

BlacklistedSiteService org.mitre.openid.connect.web.BlacklistAPI.blacklistService
private

◆ gson

Gson org.mitre.openid.connect.web.BlacklistAPI.gson = new Gson()
private

◆ logger

final Logger org.mitre.openid.connect.web.BlacklistAPI.logger = LoggerFactory.getLogger(BlacklistAPI.class)
staticprivate

Logger for this class

◆ parser

JsonParser org.mitre.openid.connect.web.BlacklistAPI.parser = new JsonParser()
private

◆ URL

final String org.mitre.openid.connect.web.BlacklistAPI.URL = RootController.API_URL + "/blacklist"
static

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