keycloak
静的公開メンバ関数 | 全メンバ一覧
org.keycloak.models.utils.StripSecretsUtils クラス
org.keycloak.models.utils.StripSecretsUtils 連携図
Collaboration graph

静的公開メンバ関数

static ComponentRepresentation strip (KeycloakSession session, ComponentRepresentation rep)
 
static RealmRepresentation strip (RealmRepresentation rep)
 
static IdentityProviderRepresentation strip (IdentityProviderRepresentation rep)
 
static RealmRepresentation stripForExport (KeycloakSession session, RealmRepresentation rep)
 
static UserRepresentation strip (UserRepresentation user)
 
static ClientRepresentation strip (ClientRepresentation rep)
 
static ComponentExportRepresentation strip (KeycloakSession session, String providerType, ComponentExportRepresentation rep)
 

詳解

著者
Stian Thorgersen

関数詳解

◆ strip() [1/6]

static ComponentRepresentation org.keycloak.models.utils.StripSecretsUtils.strip ( KeycloakSession  session,
ComponentRepresentation  rep 
)
inlinestatic
41  {
42  Map<String, ProviderConfigProperty> configProperties = ComponentUtil.getComponentConfigProperties(session, rep);
43  if (rep.getConfig() == null) {
44  return rep;
45  }
46 
47  Iterator<Map.Entry<String, List<String>>> itr = rep.getConfig().entrySet().iterator();
48  while (itr.hasNext()) {
49  Map.Entry<String, List<String>> next = itr.next();
50  ProviderConfigProperty configProperty = configProperties.get(next.getKey());
51  if (configProperty != null) {
52  if (configProperty.isSecret()) {
53  next.setValue(Collections.singletonList(ComponentRepresentation.SECRET_VALUE));
54  }
55  } else {
56  itr.remove();
57  }
58  }
59  return rep;
60  }

◆ strip() [2/6]

static RealmRepresentation org.keycloak.models.utils.StripSecretsUtils.strip ( RealmRepresentation  rep)
inlinestatic
62  {
63  if (rep.getSmtpServer() != null && rep.getSmtpServer().containsKey("password")) {
64  rep.getSmtpServer().put("password", ComponentRepresentation.SECRET_VALUE);
65  }
66  return rep;
67  }

◆ strip() [3/6]

static IdentityProviderRepresentation org.keycloak.models.utils.StripSecretsUtils.strip ( IdentityProviderRepresentation  rep)
inlinestatic
69  {
70  if (rep.getConfig() != null && rep.getConfig().containsKey("clientSecret")) {
71  rep.getConfig().put("clientSecret", ComponentRepresentation.SECRET_VALUE);
72  }
73  return rep;
74  }

◆ strip() [4/6]

static UserRepresentation org.keycloak.models.utils.StripSecretsUtils.strip ( UserRepresentation  user)
inlinestatic
118  {
119  user.setCredentials(null);
120  return user;
121  }

◆ strip() [5/6]

static ClientRepresentation org.keycloak.models.utils.StripSecretsUtils.strip ( ClientRepresentation  rep)
inlinestatic
123  {
124  if (rep.getSecret() != null) {
125  rep.setSecret(ComponentRepresentation.SECRET_VALUE);
126  }
127  return rep;
128  }

◆ strip() [6/6]

static ComponentExportRepresentation org.keycloak.models.utils.StripSecretsUtils.strip ( KeycloakSession  session,
String  providerType,
ComponentExportRepresentation  rep 
)
inlinestatic
130  {
131  Map<String, ProviderConfigProperty> configProperties = ComponentUtil.getComponentConfigProperties(session, providerType, rep.getProviderId());
132  if (rep.getConfig() == null) {
133  return rep;
134  }
135 
136  Iterator<Map.Entry<String, List<String>>> itr = rep.getConfig().entrySet().iterator();
137  while (itr.hasNext()) {
138  Map.Entry<String, List<String>> next = itr.next();
139  ProviderConfigProperty configProperty = configProperties.get(next.getKey());
140  if (configProperty != null) {
141  if (configProperty.isSecret()) {
142  next.setValue(Collections.singletonList(ComponentRepresentation.SECRET_VALUE));
143  }
144  } else {
145  itr.remove();
146  }
147  }
148 
149  MultivaluedHashMap<String, ComponentExportRepresentation> sub = rep.getSubComponents();
150  for (Map.Entry<String, List<ComponentExportRepresentation>> ent: sub.entrySet()) {
151  for (ComponentExportRepresentation c: ent.getValue()) {
152  strip(session, ent.getKey(), c);
153  }
154  }
155  return rep;
156  }
static ComponentRepresentation strip(KeycloakSession session, ComponentRepresentation rep)
Definition: StripSecretsUtils.java:41

◆ stripForExport()

static RealmRepresentation org.keycloak.models.utils.StripSecretsUtils.stripForExport ( KeycloakSession  session,
RealmRepresentation  rep 
)
inlinestatic
76  {
77  strip(rep);
78 
79  List<ClientRepresentation> clients = rep.getClients();
80  if (clients != null) {
81  for (ClientRepresentation c : clients) {
82  strip(c);
83  }
84  }
85  List<IdentityProviderRepresentation> providers = rep.getIdentityProviders();
86  if (providers != null) {
87  for (IdentityProviderRepresentation r : providers) {
88  strip(r);
89  }
90  }
91 
92  MultivaluedHashMap<String, ComponentExportRepresentation> components = rep.getComponents();
93  if (components != null) {
94  for (Map.Entry<String, List<ComponentExportRepresentation>> ent : components.entrySet()) {
95  for (ComponentExportRepresentation c : ent.getValue()) {
96  strip(session, ent.getKey(), c);
97  }
98  }
99  }
100 
101  List<UserRepresentation> users = rep.getUsers();
102  if (users != null) {
103  for (UserRepresentation u: users) {
104  strip(u);
105  }
106  }
107 
108  users = rep.getFederatedUsers();
109  if (users != null) {
110  for (UserRepresentation u: users) {
111  strip(u);
112  }
113  }
114 
115  return rep;
116  }
static ComponentRepresentation strip(KeycloakSession session, ComponentRepresentation rep)
Definition: StripSecretsUtils.java:41

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