gluu
公開メンバ関数 | 関数 | 非公開変数類 | 全メンバ一覧
org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel クラス
org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel の継承関係図
Inheritance graph
org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel 連携図
Collaboration graph

公開メンバ関数

List< AuthnMethodStatusgetMethods ()
 
void init ()
 
void selectionChanged (@BindingParam("evt") SelectEvent< Listitem, Pair< String, String >> event, @BindingParam("acr") String acr)
 
void checkMethod (@BindingParam("acr") String acr, @BindingParam("checked") boolean checked)
 
void save ()
 
String getSubpage ()
 
List< AdminConsoleMenuItemgetExtraButtons ()
 
void loadSubPage (@BindingParam("page") String page)
 
MainSettings getSettings ()
 

関数

boolean updateMainSettings (String sucessMessage)
 
boolean updateMainSettings ()
 

非公開変数類

Logger logger = LoggerFactory.getLogger(getClass())
 
ConfigurationHandler confHandler
 
ExtensionsManager extManager
 
UserService userService
 
List< AuthnMethodStatusmethods
 

詳解

著者
jgomer

関数詳解

◆ checkMethod()

void org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.checkMethod ( @BindingParam("acr") String  acr,
@BindingParam("checked") boolean  checked 
)
inline
105  {
106 
107  AuthnMethodStatus methodStatus = methods.stream().filter(ams -> ams.getAcr().equals(acr)).findAny().get();
108  methodStatus.setEnabled(checked);
109 
110  if (!checked && !userService.zeroPreferences(acr)) { //Was it disabled and still there are people with such preference?
111  Messagebox.show(Labels.getLabel("adm.methods_existing_credentials", new String[]{ acr }), null,
112  Messagebox.OK, Messagebox.EXCLAMATION);
113  //revert it to enabled
114  methodStatus.setEnabled(true);
115  }
116  }
List< AuthnMethodStatus > methods
Definition: AuthnMethodsViewModel.java:52
boolean zeroPreferences(String acr)
Definition: UserService.java:206
UserService userService
Definition: AuthnMethodsViewModel.java:50

◆ getExtraButtons()

List<AdminConsoleMenuItem> org.gluu.credmanager.ui.vm.admin.MainViewModel.getExtraButtons ( )
inlineinherited
49  {
50  return extraButtons;
51  }
List< AdminConsoleMenuItem > extraButtons
Definition: MainViewModel.java:41

◆ getMethods()

List<AuthnMethodStatus> org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.getMethods ( )
inline
54  {
55  return methods;
56  }
List< AuthnMethodStatus > methods
Definition: AuthnMethodsViewModel.java:52

◆ getSettings()

MainSettings org.gluu.credmanager.ui.vm.admin.MainViewModel.getSettings ( )
inlineinherited
70  {
71  return confHandler.getSettings();
72  }
ConfigurationHandler confHandler
Definition: MainViewModel.java:36
MainSettings getSettings()
Definition: ConfigurationHandler.java:126

◆ getSubpage()

String org.gluu.credmanager.ui.vm.admin.MainViewModel.getSubpage ( )
inlineinherited
45  {
46  return subpage;
47  }
String subpage
Definition: MainViewModel.java:43

◆ init()

void org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.init ( )
inline
59  {
60 
61  List<PluginDescriptor> currentPlugins = extManager.getPlugins().stream().filter(w -> w.getPluginState().equals(PluginState.STARTED))
62  .map(PluginWrapper::getDescriptor).collect(Collectors.toList());
63  Map<String, String> mappedAcrs = getSettings().getAcrPluginMap();
64  //The following map contains entries associated to active acr methods in oxauth
65  Map<String, Integer> authnMethodLevels = confHandler.getAcrLevelMapping();
66  //These are the acrs which have a corresponding plugin or system extension implemented for it
67  List<AuthnMethod> list = extManager.getAuthnMethodExts().stream().filter(aMethod -> authnMethodLevels.containsKey(aMethod.getAcr()))
68  .sorted(Comparator.comparing(aMethod -> -authnMethodLevels.get(aMethod.getAcr()))).collect(Collectors.toList());
69 
70  methods = new ArrayList<>();
71  for (AuthnMethod aMethod : list) {
72  String acr = aMethod.getAcr();
73  AuthnMethodStatus ams = new AuthnMethodStatus();
74  ams.setAcr(acr);
75  ams.setName(Labels.getLabel(aMethod.getUINameKey()));
76  ams.setEnabled(mappedAcrs.keySet().contains(acr));
77 
78  List<Pair<String, String>> plugins = new ArrayList<>();
79  for (PluginDescriptor de : currentPlugins) {
80  String id = de.getPluginId();
82  plugins.add(new Pair<>(id, Labels.getLabel("adm.method_plugin_template", new String[] {id, de.getVersion()})));
83  }
84  }
85  if (plugins.size() == 0) {
86  plugins.add(new Pair<>(null, Labels.getLabel("adm.method_sysextension")));
87  }
88  ams.setPlugins(plugins);
89  ams.setSelectedPugin(mappedAcrs.get(acr));
90 
91  methods.add(ams);
92  }
93 
94  }
List< AuthnMethod > getAuthnMethodExts()
Definition: ExtensionsManager.java:180
ExtensionsManager extManager
Definition: AuthnMethodsViewModel.java:47
List< AuthnMethodStatus > methods
Definition: AuthnMethodsViewModel.java:52
ConfigurationHandler confHandler
Definition: AuthnMethodsViewModel.java:44
MainSettings getSettings()
Definition: MainViewModel.java:70
boolean pluginImplementsAuthnMethod(String acr, String plugId)
Definition: ExtensionsManager.java:155
Map< String, Integer > getAcrLevelMapping()
Definition: ConfigurationHandler.java:222
List< PluginWrapper > getPlugins()
Definition: ExtensionsManager.java:192
Map< String, String > getAcrPluginMap()
Definition: MainSettings.java:110

◆ loadSubPage()

void org.gluu.credmanager.ui.vm.admin.MainViewModel.loadSubPage ( @BindingParam("page") String  page)
inlineinherited

Changes the page loaded in the content area. Also sets values needed in the UI (these are taken directly from calls to AdminService's getConfigSettings method.

引数
pageThe (string) url of the page that must be loaded (by default /admin/default.zul is being shown)
66  {
67  subpage = page;
68  }
String subpage
Definition: MainViewModel.java:43

◆ save()

void org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.save ( )
inline
119  {
120 
121  Map<String, String> pluginMapping = methods.stream().filter(AuthnMethodStatus::isEnabled)
123  getSettings().setAcrPluginMap(pluginMapping);
125 
126  }
boolean updateMainSettings()
Definition: MainViewModel.java:94
String getSelectedPugin()
Definition: AuthnMethodStatus.java:35
boolean isEnabled()
Definition: AuthnMethodStatus.java:23
List< AuthnMethodStatus > methods
Definition: AuthnMethodsViewModel.java:52
String getAcr()
Definition: AuthnMethodStatus.java:27
void setAcrPluginMap(Map< String, String > acrPluginMap)
Definition: MainSettings.java:174
MainSettings getSettings()
Definition: MainViewModel.java:70

◆ selectionChanged()

void org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.selectionChanged ( @BindingParam("evt") SelectEvent< Listitem, Pair< String, String >>  event,
@BindingParam("acr") String  acr 
)
inline
97  {
98  String pluginId = event.getSelectedObjects().stream().map(Pair::getX).findAny().get();
99  //Finds the right entry in methods and updates selectedPlugin member
100  methods.stream().filter(ams -> ams.getAcr().equals(acr)).findAny().get().setSelectedPugin(pluginId);
101  }
List< AuthnMethodStatus > methods
Definition: AuthnMethodsViewModel.java:52

◆ updateMainSettings() [1/2]

boolean org.gluu.credmanager.ui.vm.admin.MainViewModel.updateMainSettings ( String  sucessMessage)
inlinepackageinherited
74  {
75 
76  boolean success = false;
77  try {
78  //update app-level config and persist
79  getSettings().save();
80  if (sucessMessage == null) {
81  UIUtils.showMessageUI(true);
82  } else {
83  Messagebox.show(sucessMessage, null, Messagebox.OK, Messagebox.INFORMATION);
84  }
85  success = true;
86  } catch (Exception e) {
87  logger.error(e.getMessage(), e);
88  UIUtils.showMessageUI(false, Labels.getLabel("adm.conffile_error_update"));
89  }
90  return success;
91 
92  }
void save()
Definition: MainSettings.java:85
MainSettings getSettings()
Definition: MainViewModel.java:70
Logger logger
Definition: MainViewModel.java:33

◆ updateMainSettings() [2/2]

boolean org.gluu.credmanager.ui.vm.admin.MainViewModel.updateMainSettings ( )
inlinepackageinherited
94  {
95  return updateMainSettings(null);
96  }
boolean updateMainSettings()
Definition: MainViewModel.java:94

メンバ詳解

◆ confHandler

ConfigurationHandler org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.confHandler
private

◆ extManager

ExtensionsManager org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.extManager
private

◆ logger

Logger org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.logger = LoggerFactory.getLogger(getClass())
private

◆ methods

List<AuthnMethodStatus> org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.methods
private

◆ userService

UserService org.gluu.credmanager.ui.vm.admin.AuthnMethodsViewModel.userService
private

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