keycloak-service
公開メンバ関数 | 静的公開メンバ関数 | 静的公開変数類 | 静的非公開変数類 | 全メンバ一覧
org.keycloak.keys.ImportedRsaKeyProviderFactory クラス
org.keycloak.keys.ImportedRsaKeyProviderFactory の継承関係図
Inheritance graph
org.keycloak.keys.ImportedRsaKeyProviderFactory 連携図
Collaboration graph

公開メンバ関数

KeyProvider create (KeycloakSession session, ComponentModel model)
 
void validateConfiguration (KeycloakSession session, RealmModel realm, ComponentModel model) throws ComponentValidationException
 
String getHelpText ()
 
List< ProviderConfigProperty > getConfigProperties ()
 
String getId ()
 

静的公開メンバ関数

static final ProviderConfigurationBuilder configurationBuilder ()
 

静的公開変数類

static final String ID = "rsa"
 

静的非公開変数類

static final String HELP_TEXT = "RSA key provider that can optionally generated a self-signed certificate"
 
static final List< ProviderConfigProperty > CONFIG_PROPERTIES
 

詳解

著者
Stian Thorgersen

関数詳解

◆ configurationBuilder()

static final ProviderConfigurationBuilder org.keycloak.keys.AbstractRsaKeyProviderFactory.configurationBuilder ( )
inlinestaticinherited
32  {
33  return ProviderConfigurationBuilder.create()
34  .property(Attributes.PRIORITY_PROPERTY)
35  .property(Attributes.ENABLED_PROPERTY)
36  .property(Attributes.ACTIVE_PROPERTY)
37  .property(Attributes.RS_ALGORITHM_PROPERTY);
38  }

◆ create()

KeyProvider org.keycloak.keys.ImportedRsaKeyProviderFactory.create ( KeycloakSession  session,
ComponentModel  model 
)
inline
51  {
52  return new ImportedRsaKeyProvider(session.getContext().getRealm(), model);
53  }

◆ getConfigProperties()

List<ProviderConfigProperty> org.keycloak.keys.ImportedRsaKeyProviderFactory.getConfigProperties ( )
inline
103  {
104  return CONFIG_PROPERTIES;
105  }
static final List< ProviderConfigProperty > CONFIG_PROPERTIES
Definition: ImportedRsaKeyProviderFactory.java:45

◆ getHelpText()

String org.keycloak.keys.ImportedRsaKeyProviderFactory.getHelpText ( )
inline
98  {
99  return HELP_TEXT;
100  }
static final String HELP_TEXT
Definition: ImportedRsaKeyProviderFactory.java:43

◆ getId()

String org.keycloak.keys.ImportedRsaKeyProviderFactory.getId ( )
inline
108  {
109  return ID;
110  }
static final String ID
Definition: ImportedRsaKeyProviderFactory.java:41

◆ validateConfiguration()

void org.keycloak.keys.ImportedRsaKeyProviderFactory.validateConfiguration ( KeycloakSession  session,
RealmModel  realm,
ComponentModel  model 
) throws ComponentValidationException
inline
56  {
57  super.validateConfiguration(session, realm, model);
58 
59  ConfigurationValidationHelper.check(model)
60  .checkSingle(Attributes.PRIVATE_KEY_PROPERTY, true)
61  .checkSingle(Attributes.CERTIFICATE_PROPERTY, false);
62 
63  KeyPair keyPair;
64  try {
65  PrivateKey privateKey = PemUtils.decodePrivateKey(model.get(Attributes.PRIVATE_KEY_KEY));
66  PublicKey publicKey = KeyUtils.extractPublicKey(privateKey);
67  keyPair = new KeyPair(publicKey, privateKey);
68  } catch (Throwable t) {
69  throw new ComponentValidationException("Failed to decode private key", t);
70  }
71 
72  if (model.contains(Attributes.CERTIFICATE_KEY)) {
73  Certificate certificate = null;
74  try {
75  certificate = PemUtils.decodeCertificate(model.get(Attributes.CERTIFICATE_KEY));
76  } catch (Throwable t) {
77  throw new ComponentValidationException("Failed to decode certificate", t);
78  }
79 
80  if (certificate == null) {
81  throw new ComponentValidationException("Failed to decode certificate");
82  }
83 
84  if (!certificate.getPublicKey().equals(keyPair.getPublic())) {
85  throw new ComponentValidationException("Certificate does not match private key");
86  }
87  } else {
88  try {
89  Certificate certificate = CertificateUtils.generateV1SelfSignedCertificate(keyPair, realm.getName());
90  model.put(Attributes.CERTIFICATE_KEY, PemUtils.encodeCertificate(certificate));
91  } catch (Throwable t) {
92  throw new ComponentValidationException("Failed to generate self-signed certificate");
93  }
94  }
95  }

メンバ詳解

◆ CONFIG_PROPERTIES

final List<ProviderConfigProperty> org.keycloak.keys.ImportedRsaKeyProviderFactory.CONFIG_PROPERTIES
staticprivate
初期値:
= AbstractRsaKeyProviderFactory.configurationBuilder()
.property(Attributes.PRIVATE_KEY_PROPERTY)
.property(Attributes.CERTIFICATE_PROPERTY)
.build()

◆ HELP_TEXT

final String org.keycloak.keys.ImportedRsaKeyProviderFactory.HELP_TEXT = "RSA key provider that can optionally generated a self-signed certificate"
staticprivate

◆ ID

final String org.keycloak.keys.ImportedRsaKeyProviderFactory.ID = "rsa"
static

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