001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2008 Sun Microsystems, Inc. 015 */ 016package org.forgerock.opendj.server.config.meta; 017 018 019 020import java.util.Collection; 021import java.util.SortedSet; 022import org.forgerock.opendj.config.AdministratorAction; 023import org.forgerock.opendj.config.AggregationPropertyDefinition; 024import org.forgerock.opendj.config.AliasDefaultBehaviorProvider; 025import org.forgerock.opendj.config.BooleanPropertyDefinition; 026import org.forgerock.opendj.config.ClassPropertyDefinition; 027import org.forgerock.opendj.config.client.ConcurrentModificationException; 028import org.forgerock.opendj.config.client.ManagedObject; 029import org.forgerock.opendj.config.client.MissingMandatoryPropertiesException; 030import org.forgerock.opendj.config.client.OperationRejectedException; 031import org.forgerock.opendj.config.conditions.Conditions; 032import org.forgerock.opendj.config.DefaultBehaviorProvider; 033import org.forgerock.opendj.config.DefinedDefaultBehaviorProvider; 034import org.forgerock.opendj.config.DurationPropertyDefinition; 035import org.forgerock.opendj.config.ManagedObjectAlreadyExistsException; 036import org.forgerock.opendj.config.ManagedObjectDefinition; 037import org.forgerock.opendj.config.PropertyOption; 038import org.forgerock.opendj.config.PropertyProvider; 039import org.forgerock.opendj.config.server.ConfigurationChangeListener; 040import org.forgerock.opendj.config.server.ServerManagedObject; 041import org.forgerock.opendj.config.StringPropertyDefinition; 042import org.forgerock.opendj.config.UndefinedDefaultBehaviorProvider; 043import org.forgerock.opendj.ldap.DN; 044import org.forgerock.opendj.ldap.LdapException; 045import org.forgerock.opendj.server.config.client.HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient; 046import org.forgerock.opendj.server.config.client.IdentityMapperCfgClient; 047import org.forgerock.opendj.server.config.client.KeyManagerProviderCfgClient; 048import org.forgerock.opendj.server.config.client.TrustManagerProviderCfgClient; 049import org.forgerock.opendj.server.config.server.HTTPAuthorizationMechanismCfg; 050import org.forgerock.opendj.server.config.server.HTTPOauth2AuthorizationMechanismCfg; 051import org.forgerock.opendj.server.config.server.HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg; 052import org.forgerock.opendj.server.config.server.IdentityMapperCfg; 053import org.forgerock.opendj.server.config.server.KeyManagerProviderCfg; 054import org.forgerock.opendj.server.config.server.TrustManagerProviderCfg; 055 056 057 058/** 059 * An interface for querying the HTTP Oauth2 Token Introspection 060 * Authorization Mechanism managed object definition meta information. 061 * <p> 062 * The HTTP Oauth2 Token Introspection Authorization Mechanism is used 063 * to define OAuth2 authorization using an introspection (RFC7662) 064 * compliant authorization server. 065 */ 066public final class HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgDefn extends ManagedObjectDefinition<HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient, HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> { 067 068 /** The singleton configuration definition instance. */ 069 private static final HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgDefn INSTANCE = new HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgDefn(); 070 071 072 073 /** The "authzid-json-pointer" property definition. */ 074 private static final StringPropertyDefinition PD_AUTHZID_JSON_POINTER; 075 076 077 078 /** The "client-id" property definition. */ 079 private static final StringPropertyDefinition PD_CLIENT_ID; 080 081 082 083 /** The "client-secret" property definition. */ 084 private static final StringPropertyDefinition PD_CLIENT_SECRET; 085 086 087 088 /** The "java-class" property definition. */ 089 private static final ClassPropertyDefinition PD_JAVA_CLASS; 090 091 092 093 /** The "key-manager-provider" property definition. */ 094 private static final AggregationPropertyDefinition<KeyManagerProviderCfgClient, KeyManagerProviderCfg> PD_KEY_MANAGER_PROVIDER; 095 096 097 098 /** The "token-introspection-url" property definition. */ 099 private static final StringPropertyDefinition PD_TOKEN_INTROSPECTION_URL; 100 101 102 103 /** The "trust-manager-provider" property definition. */ 104 private static final AggregationPropertyDefinition<TrustManagerProviderCfgClient, TrustManagerProviderCfg> PD_TRUST_MANAGER_PROVIDER; 105 106 107 108 /** Build the "authzid-json-pointer" property definition. */ 109 static { 110 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "authzid-json-pointer"); 111 builder.setOption(PropertyOption.MANDATORY); 112 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "authzid-json-pointer")); 113 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 114 PD_AUTHZID_JSON_POINTER = builder.getInstance(); 115 INSTANCE.registerPropertyDefinition(PD_AUTHZID_JSON_POINTER); 116 } 117 118 119 120 /** Build the "client-id" property definition. */ 121 static { 122 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "client-id"); 123 builder.setOption(PropertyOption.MANDATORY); 124 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "client-id")); 125 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 126 PD_CLIENT_ID = builder.getInstance(); 127 INSTANCE.registerPropertyDefinition(PD_CLIENT_ID); 128 } 129 130 131 132 /** Build the "client-secret" property definition. */ 133 static { 134 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "client-secret"); 135 builder.setOption(PropertyOption.MANDATORY); 136 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "client-secret")); 137 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 138 PD_CLIENT_SECRET = builder.getInstance(); 139 INSTANCE.registerPropertyDefinition(PD_CLIENT_SECRET); 140 } 141 142 143 144 /** Build the "java-class" property definition. */ 145 static { 146 ClassPropertyDefinition.Builder builder = ClassPropertyDefinition.createBuilder(INSTANCE, "java-class"); 147 builder.setOption(PropertyOption.MANDATORY); 148 builder.setOption(PropertyOption.ADVANCED); 149 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "java-class")); 150 DefaultBehaviorProvider<String> provider = new DefinedDefaultBehaviorProvider<String>("org.opends.server.protocols.http.authz.HttpOAuth2TokenIntrospectionAuthorizationMechanism"); 151 builder.setDefaultBehaviorProvider(provider); 152 builder.addInstanceOf("org.opends.server.protocols.http.authz.HttpAuthorizationMechanism"); 153 PD_JAVA_CLASS = builder.getInstance(); 154 INSTANCE.registerPropertyDefinition(PD_JAVA_CLASS); 155 } 156 157 158 159 /** Build the "key-manager-provider" property definition. */ 160 static { 161 AggregationPropertyDefinition.Builder<KeyManagerProviderCfgClient, KeyManagerProviderCfg> builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "key-manager-provider"); 162 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "key-manager-provider")); 163 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 164 builder.setParentPath("/"); 165 builder.setRelationDefinition("key-manager-provider"); 166 builder.setTargetIsEnabledCondition(Conditions.contains("enabled", "true")); 167 PD_KEY_MANAGER_PROVIDER = builder.getInstance(); 168 INSTANCE.registerPropertyDefinition(PD_KEY_MANAGER_PROVIDER); 169 INSTANCE.registerConstraint(PD_KEY_MANAGER_PROVIDER.getSourceConstraint()); 170 } 171 172 173 174 /** Build the "token-introspection-url" property definition. */ 175 static { 176 StringPropertyDefinition.Builder builder = StringPropertyDefinition.createBuilder(INSTANCE, "token-introspection-url"); 177 builder.setOption(PropertyOption.MANDATORY); 178 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "token-introspection-url")); 179 builder.setDefaultBehaviorProvider(new UndefinedDefaultBehaviorProvider<String>()); 180 PD_TOKEN_INTROSPECTION_URL = builder.getInstance(); 181 INSTANCE.registerPropertyDefinition(PD_TOKEN_INTROSPECTION_URL); 182 } 183 184 185 186 /** Build the "trust-manager-provider" property definition. */ 187 static { 188 AggregationPropertyDefinition.Builder<TrustManagerProviderCfgClient, TrustManagerProviderCfg> builder = AggregationPropertyDefinition.createBuilder(INSTANCE, "trust-manager-provider"); 189 builder.setAdministratorAction(new AdministratorAction(AdministratorAction.Type.NONE, INSTANCE, "trust-manager-provider")); 190 builder.setDefaultBehaviorProvider(new AliasDefaultBehaviorProvider<String>(INSTANCE, "trust-manager-provider")); 191 builder.setParentPath("/"); 192 builder.setRelationDefinition("trust-manager-provider"); 193 builder.setTargetIsEnabledCondition(Conditions.contains("enabled", "true")); 194 PD_TRUST_MANAGER_PROVIDER = builder.getInstance(); 195 INSTANCE.registerPropertyDefinition(PD_TRUST_MANAGER_PROVIDER); 196 INSTANCE.registerConstraint(PD_TRUST_MANAGER_PROVIDER.getSourceConstraint()); 197 } 198 199 200 201 /** 202 * Get the HTTP Oauth2 Token Introspection Authorization Mechanism 203 * configuration definition singleton. 204 * 205 * @return Returns the HTTP Oauth2 Token Introspection Authorization 206 * Mechanism configuration definition singleton. 207 */ 208 public static HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgDefn getInstance() { 209 return INSTANCE; 210 } 211 212 213 214 /** 215 * Private constructor. 216 */ 217 private HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgDefn() { 218 super("http-oauth2-token-introspection-authorization-mechanism", HTTPOauth2AuthorizationMechanismCfgDefn.getInstance()); 219 } 220 221 222 223 /** {@inheritDoc} */ 224 public HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient createClientConfiguration( 225 ManagedObject<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient> impl) { 226 return new HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClientImpl(impl); 227 } 228 229 230 231 /** {@inheritDoc} */ 232 public HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg createServerConfiguration( 233 ServerManagedObject<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> impl) { 234 return new HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgServerImpl(impl); 235 } 236 237 238 239 /** {@inheritDoc} */ 240 public Class<HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> getServerConfigurationClass() { 241 return HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg.class; 242 } 243 244 245 246 /** 247 * Get the "access-token-cache-enabled" property definition. 248 * <p> 249 * Indicates whether the HTTP Oauth2 Token Introspection 250 * Authorization Mechanism is enabled for use. 251 * 252 * @return Returns the "access-token-cache-enabled" property definition. 253 */ 254 public BooleanPropertyDefinition getAccessTokenCacheEnabledPropertyDefinition() { 255 return HTTPOauth2AuthorizationMechanismCfgDefn.getInstance().getAccessTokenCacheEnabledPropertyDefinition(); 256 } 257 258 259 260 /** 261 * Get the "access-token-cache-expiration" property definition. 262 * <p> 263 * Token cache expiration 264 * 265 * @return Returns the "access-token-cache-expiration" property definition. 266 */ 267 public DurationPropertyDefinition getAccessTokenCacheExpirationPropertyDefinition() { 268 return HTTPOauth2AuthorizationMechanismCfgDefn.getInstance().getAccessTokenCacheExpirationPropertyDefinition(); 269 } 270 271 272 273 /** 274 * Get the "authzid-json-pointer" property definition. 275 * <p> 276 * Specifies the JSON pointer to the value to use as Authorization 277 * ID. The JSON pointer is applied to the resolved access token JSON 278 * document. (example: /uid) 279 * 280 * @return Returns the "authzid-json-pointer" property definition. 281 */ 282 public StringPropertyDefinition getAuthzidJsonPointerPropertyDefinition() { 283 return PD_AUTHZID_JSON_POINTER; 284 } 285 286 287 288 /** 289 * Get the "client-id" property definition. 290 * <p> 291 * Client's ID to use during the HTTP basic authentication against 292 * the authorization server. 293 * 294 * @return Returns the "client-id" property definition. 295 */ 296 public StringPropertyDefinition getClientIdPropertyDefinition() { 297 return PD_CLIENT_ID; 298 } 299 300 301 302 /** 303 * Get the "client-secret" property definition. 304 * <p> 305 * Client's secret to use during the HTTP basic authentication 306 * against the authorization server. 307 * 308 * @return Returns the "client-secret" property definition. 309 */ 310 public StringPropertyDefinition getClientSecretPropertyDefinition() { 311 return PD_CLIENT_SECRET; 312 } 313 314 315 316 /** 317 * Get the "enabled" property definition. 318 * <p> 319 * Indicates whether the HTTP Oauth2 Token Introspection 320 * Authorization Mechanism is enabled. 321 * 322 * @return Returns the "enabled" property definition. 323 */ 324 public BooleanPropertyDefinition getEnabledPropertyDefinition() { 325 return HTTPOauth2AuthorizationMechanismCfgDefn.getInstance().getEnabledPropertyDefinition(); 326 } 327 328 329 330 /** 331 * Get the "identity-mapper" property definition. 332 * <p> 333 * > Specifies the name of the identity mapper to use in conjunction 334 * with the authzid-json-pointer to get the user corresponding to the 335 * acccess-token. 336 * 337 * @return Returns the "identity-mapper" property definition. 338 */ 339 public AggregationPropertyDefinition<IdentityMapperCfgClient, IdentityMapperCfg> getIdentityMapperPropertyDefinition() { 340 return HTTPOauth2AuthorizationMechanismCfgDefn.getInstance().getIdentityMapperPropertyDefinition(); 341 } 342 343 344 345 /** 346 * Get the "java-class" property definition. 347 * <p> 348 * Specifies the fully-qualified name of the Java class that 349 * provides the HTTP Oauth2 Token Introspection Authorization 350 * Mechanism implementation. 351 * 352 * @return Returns the "java-class" property definition. 353 */ 354 public ClassPropertyDefinition getJavaClassPropertyDefinition() { 355 return PD_JAVA_CLASS; 356 } 357 358 359 360 /** 361 * Get the "key-manager-provider" property definition. 362 * <p> 363 * Specifies the name of the key manager that should be used with 364 * this HTTP Oauth2 Token Introspection Authorization Mechanism . 365 * 366 * @return Returns the "key-manager-provider" property definition. 367 */ 368 public AggregationPropertyDefinition<KeyManagerProviderCfgClient, KeyManagerProviderCfg> getKeyManagerProviderPropertyDefinition() { 369 return PD_KEY_MANAGER_PROVIDER; 370 } 371 372 373 374 /** 375 * Get the "required-scope" property definition. 376 * <p> 377 * Scopes required to grant access to the service. 378 * 379 * @return Returns the "required-scope" property definition. 380 */ 381 public StringPropertyDefinition getRequiredScopePropertyDefinition() { 382 return HTTPOauth2AuthorizationMechanismCfgDefn.getInstance().getRequiredScopePropertyDefinition(); 383 } 384 385 386 387 /** 388 * Get the "token-introspection-url" property definition. 389 * <p> 390 * Defines the token introspection endpoint URL where the 391 * access-token resolution request should be sent. (example: 392 * http://example.com/introspect) 393 * 394 * @return Returns the "token-introspection-url" property definition. 395 */ 396 public StringPropertyDefinition getTokenIntrospectionUrlPropertyDefinition() { 397 return PD_TOKEN_INTROSPECTION_URL; 398 } 399 400 401 402 /** 403 * Get the "trust-manager-provider" property definition. 404 * <p> 405 * Specifies the name of the trust manager that should be used when 406 * negotiating SSL connections with the remote authorization server. 407 * 408 * @return Returns the "trust-manager-provider" property definition. 409 */ 410 public AggregationPropertyDefinition<TrustManagerProviderCfgClient, TrustManagerProviderCfg> getTrustManagerProviderPropertyDefinition() { 411 return PD_TRUST_MANAGER_PROVIDER; 412 } 413 414 415 416 /** 417 * Managed object client implementation. 418 */ 419 private static class HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClientImpl implements 420 HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient { 421 422 /** Private implementation. */ 423 private ManagedObject<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient> impl; 424 425 426 427 /** Private constructor. */ 428 private HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClientImpl( 429 ManagedObject<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient> impl) { 430 this.impl = impl; 431 } 432 433 434 435 /** {@inheritDoc} */ 436 public boolean isAccessTokenCacheEnabled() { 437 return impl.getPropertyValue(INSTANCE.getAccessTokenCacheEnabledPropertyDefinition()); 438 } 439 440 441 442 /** {@inheritDoc} */ 443 public void setAccessTokenCacheEnabled(boolean value) { 444 impl.setPropertyValue(INSTANCE.getAccessTokenCacheEnabledPropertyDefinition(), value); 445 } 446 447 448 449 /** {@inheritDoc} */ 450 public Long getAccessTokenCacheExpiration() { 451 return impl.getPropertyValue(INSTANCE.getAccessTokenCacheExpirationPropertyDefinition()); 452 } 453 454 455 456 /** {@inheritDoc} */ 457 public void setAccessTokenCacheExpiration(Long value) { 458 impl.setPropertyValue(INSTANCE.getAccessTokenCacheExpirationPropertyDefinition(), value); 459 } 460 461 462 463 /** {@inheritDoc} */ 464 public String getAuthzidJsonPointer() { 465 return impl.getPropertyValue(INSTANCE.getAuthzidJsonPointerPropertyDefinition()); 466 } 467 468 469 470 /** {@inheritDoc} */ 471 public void setAuthzidJsonPointer(String value) { 472 impl.setPropertyValue(INSTANCE.getAuthzidJsonPointerPropertyDefinition(), value); 473 } 474 475 476 477 /** {@inheritDoc} */ 478 public String getClientId() { 479 return impl.getPropertyValue(INSTANCE.getClientIdPropertyDefinition()); 480 } 481 482 483 484 /** {@inheritDoc} */ 485 public void setClientId(String value) { 486 impl.setPropertyValue(INSTANCE.getClientIdPropertyDefinition(), value); 487 } 488 489 490 491 /** {@inheritDoc} */ 492 public String getClientSecret() { 493 return impl.getPropertyValue(INSTANCE.getClientSecretPropertyDefinition()); 494 } 495 496 497 498 /** {@inheritDoc} */ 499 public void setClientSecret(String value) { 500 impl.setPropertyValue(INSTANCE.getClientSecretPropertyDefinition(), value); 501 } 502 503 504 505 /** {@inheritDoc} */ 506 public Boolean isEnabled() { 507 return impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 508 } 509 510 511 512 /** {@inheritDoc} */ 513 public void setEnabled(boolean value) { 514 impl.setPropertyValue(INSTANCE.getEnabledPropertyDefinition(), value); 515 } 516 517 518 519 /** {@inheritDoc} */ 520 public String getIdentityMapper() { 521 return impl.getPropertyValue(INSTANCE.getIdentityMapperPropertyDefinition()); 522 } 523 524 525 526 /** {@inheritDoc} */ 527 public void setIdentityMapper(String value) { 528 impl.setPropertyValue(INSTANCE.getIdentityMapperPropertyDefinition(), value); 529 } 530 531 532 533 /** {@inheritDoc} */ 534 public String getJavaClass() { 535 return impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 536 } 537 538 539 540 /** {@inheritDoc} */ 541 public void setJavaClass(String value) { 542 impl.setPropertyValue(INSTANCE.getJavaClassPropertyDefinition(), value); 543 } 544 545 546 547 /** {@inheritDoc} */ 548 public String getKeyManagerProvider() { 549 return impl.getPropertyValue(INSTANCE.getKeyManagerProviderPropertyDefinition()); 550 } 551 552 553 554 /** {@inheritDoc} */ 555 public void setKeyManagerProvider(String value) { 556 impl.setPropertyValue(INSTANCE.getKeyManagerProviderPropertyDefinition(), value); 557 } 558 559 560 561 /** {@inheritDoc} */ 562 public SortedSet<String> getRequiredScope() { 563 return impl.getPropertyValues(INSTANCE.getRequiredScopePropertyDefinition()); 564 } 565 566 567 568 /** {@inheritDoc} */ 569 public void setRequiredScope(Collection<String> values) { 570 impl.setPropertyValues(INSTANCE.getRequiredScopePropertyDefinition(), values); 571 } 572 573 574 575 /** {@inheritDoc} */ 576 public String getTokenIntrospectionUrl() { 577 return impl.getPropertyValue(INSTANCE.getTokenIntrospectionUrlPropertyDefinition()); 578 } 579 580 581 582 /** {@inheritDoc} */ 583 public void setTokenIntrospectionUrl(String value) { 584 impl.setPropertyValue(INSTANCE.getTokenIntrospectionUrlPropertyDefinition(), value); 585 } 586 587 588 589 /** {@inheritDoc} */ 590 public String getTrustManagerProvider() { 591 return impl.getPropertyValue(INSTANCE.getTrustManagerProviderPropertyDefinition()); 592 } 593 594 595 596 /** {@inheritDoc} */ 597 public void setTrustManagerProvider(String value) { 598 impl.setPropertyValue(INSTANCE.getTrustManagerProviderPropertyDefinition(), value); 599 } 600 601 602 603 /** {@inheritDoc} */ 604 public ManagedObjectDefinition<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgClient, ? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> definition() { 605 return INSTANCE; 606 } 607 608 609 610 /** {@inheritDoc} */ 611 public PropertyProvider properties() { 612 return impl; 613 } 614 615 616 617 /** {@inheritDoc} */ 618 public void commit() throws ManagedObjectAlreadyExistsException, 619 MissingMandatoryPropertiesException, ConcurrentModificationException, 620 OperationRejectedException, LdapException { 621 impl.commit(); 622 } 623 624 625 626 /** {@inheritDoc} */ 627 public String toString() { 628 return impl.toString(); 629 } 630 } 631 632 633 634 /** 635 * Managed object server implementation. 636 */ 637 private static class HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgServerImpl implements 638 HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg { 639 640 /** Private implementation. */ 641 private ServerManagedObject<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> impl; 642 643 /** The value of the "access-token-cache-enabled" property. */ 644 private final boolean pAccessTokenCacheEnabled; 645 646 /** The value of the "access-token-cache-expiration" property. */ 647 private final Long pAccessTokenCacheExpiration; 648 649 /** The value of the "authzid-json-pointer" property. */ 650 private final String pAuthzidJsonPointer; 651 652 /** The value of the "client-id" property. */ 653 private final String pClientId; 654 655 /** The value of the "client-secret" property. */ 656 private final String pClientSecret; 657 658 /** The value of the "enabled" property. */ 659 private final boolean pEnabled; 660 661 /** The value of the "identity-mapper" property. */ 662 private final String pIdentityMapper; 663 664 /** The value of the "java-class" property. */ 665 private final String pJavaClass; 666 667 /** The value of the "key-manager-provider" property. */ 668 private final String pKeyManagerProvider; 669 670 /** The value of the "required-scope" property. */ 671 private final SortedSet<String> pRequiredScope; 672 673 /** The value of the "token-introspection-url" property. */ 674 private final String pTokenIntrospectionUrl; 675 676 /** The value of the "trust-manager-provider" property. */ 677 private final String pTrustManagerProvider; 678 679 680 681 /** Private constructor. */ 682 private HTTPOauth2TokenIntrospectionAuthorizationMechanismCfgServerImpl(ServerManagedObject<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> impl) { 683 this.impl = impl; 684 this.pAccessTokenCacheEnabled = impl.getPropertyValue(INSTANCE.getAccessTokenCacheEnabledPropertyDefinition()); 685 this.pAccessTokenCacheExpiration = impl.getPropertyValue(INSTANCE.getAccessTokenCacheExpirationPropertyDefinition()); 686 this.pAuthzidJsonPointer = impl.getPropertyValue(INSTANCE.getAuthzidJsonPointerPropertyDefinition()); 687 this.pClientId = impl.getPropertyValue(INSTANCE.getClientIdPropertyDefinition()); 688 this.pClientSecret = impl.getPropertyValue(INSTANCE.getClientSecretPropertyDefinition()); 689 this.pEnabled = impl.getPropertyValue(INSTANCE.getEnabledPropertyDefinition()); 690 this.pIdentityMapper = impl.getPropertyValue(INSTANCE.getIdentityMapperPropertyDefinition()); 691 this.pJavaClass = impl.getPropertyValue(INSTANCE.getJavaClassPropertyDefinition()); 692 this.pKeyManagerProvider = impl.getPropertyValue(INSTANCE.getKeyManagerProviderPropertyDefinition()); 693 this.pRequiredScope = impl.getPropertyValues(INSTANCE.getRequiredScopePropertyDefinition()); 694 this.pTokenIntrospectionUrl = impl.getPropertyValue(INSTANCE.getTokenIntrospectionUrlPropertyDefinition()); 695 this.pTrustManagerProvider = impl.getPropertyValue(INSTANCE.getTrustManagerProviderPropertyDefinition()); 696 } 697 698 699 700 /** {@inheritDoc} */ 701 public void addHTTPOauth2TokenIntrospectionAuthorizationMechanismChangeListener( 702 ConfigurationChangeListener<HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> listener) { 703 impl.registerChangeListener(listener); 704 } 705 706 707 708 /** {@inheritDoc} */ 709 public void removeHTTPOauth2TokenIntrospectionAuthorizationMechanismChangeListener( 710 ConfigurationChangeListener<HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> listener) { 711 impl.deregisterChangeListener(listener); 712 } 713 /** {@inheritDoc} */ 714 public void addHTTPOauth2AuthorizationMechanismChangeListener( 715 ConfigurationChangeListener<HTTPOauth2AuthorizationMechanismCfg> listener) { 716 impl.registerChangeListener(listener); 717 } 718 719 720 721 /** {@inheritDoc} */ 722 public void removeHTTPOauth2AuthorizationMechanismChangeListener( 723 ConfigurationChangeListener<HTTPOauth2AuthorizationMechanismCfg> listener) { 724 impl.deregisterChangeListener(listener); 725 } 726 /** {@inheritDoc} */ 727 public void addChangeListener( 728 ConfigurationChangeListener<HTTPAuthorizationMechanismCfg> listener) { 729 impl.registerChangeListener(listener); 730 } 731 732 733 734 /** {@inheritDoc} */ 735 public void removeChangeListener( 736 ConfigurationChangeListener<HTTPAuthorizationMechanismCfg> listener) { 737 impl.deregisterChangeListener(listener); 738 } 739 740 741 742 /** {@inheritDoc} */ 743 public boolean isAccessTokenCacheEnabled() { 744 return pAccessTokenCacheEnabled; 745 } 746 747 748 749 /** {@inheritDoc} */ 750 public Long getAccessTokenCacheExpiration() { 751 return pAccessTokenCacheExpiration; 752 } 753 754 755 756 /** {@inheritDoc} */ 757 public String getAuthzidJsonPointer() { 758 return pAuthzidJsonPointer; 759 } 760 761 762 763 /** {@inheritDoc} */ 764 public String getClientId() { 765 return pClientId; 766 } 767 768 769 770 /** {@inheritDoc} */ 771 public String getClientSecret() { 772 return pClientSecret; 773 } 774 775 776 777 /** {@inheritDoc} */ 778 public boolean isEnabled() { 779 return pEnabled; 780 } 781 782 783 784 /** {@inheritDoc} */ 785 public String getIdentityMapper() { 786 return pIdentityMapper; 787 } 788 789 790 791 /** 792 * {@inheritDoc} 793 */ 794 public DN getIdentityMapperDN() { 795 String value = getIdentityMapper(); 796 if (value == null) return null; 797 return INSTANCE.getIdentityMapperPropertyDefinition().getChildDN(value); 798 } 799 800 801 802 /** {@inheritDoc} */ 803 public String getJavaClass() { 804 return pJavaClass; 805 } 806 807 808 809 /** {@inheritDoc} */ 810 public String getKeyManagerProvider() { 811 return pKeyManagerProvider; 812 } 813 814 815 816 /** 817 * {@inheritDoc} 818 */ 819 public DN getKeyManagerProviderDN() { 820 String value = getKeyManagerProvider(); 821 if (value == null) return null; 822 return INSTANCE.getKeyManagerProviderPropertyDefinition().getChildDN(value); 823 } 824 825 826 827 /** {@inheritDoc} */ 828 public SortedSet<String> getRequiredScope() { 829 return pRequiredScope; 830 } 831 832 833 834 /** {@inheritDoc} */ 835 public String getTokenIntrospectionUrl() { 836 return pTokenIntrospectionUrl; 837 } 838 839 840 841 /** {@inheritDoc} */ 842 public String getTrustManagerProvider() { 843 return pTrustManagerProvider; 844 } 845 846 847 848 /** 849 * {@inheritDoc} 850 */ 851 public DN getTrustManagerProviderDN() { 852 String value = getTrustManagerProvider(); 853 if (value == null) return null; 854 return INSTANCE.getTrustManagerProviderPropertyDefinition().getChildDN(value); 855 } 856 857 858 859 /** {@inheritDoc} */ 860 public Class<? extends HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg> configurationClass() { 861 return HTTPOauth2TokenIntrospectionAuthorizationMechanismCfg.class; 862 } 863 864 865 866 /** {@inheritDoc} */ 867 public DN dn() { 868 return impl.getDN(); 869 } 870 871 872 873 /** {@inheritDoc} */ 874 public String toString() { 875 return impl.toString(); 876 } 877 } 878}