idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
18,300
public static String createNonce ( ) { val fmtDate = ZonedDateTime . now ( ZoneOffset . UTC ) . toString ( ) ; val rand = RandomUtils . getNativeInstance ( ) ; val randomInt = rand . nextInt ( ) ; return DigestUtils . md5Hex ( fmtDate + randomInt ) ; }
Create nonce string .
18,301
public static String createOpaque ( final String domain , final String nonce ) { return DigestUtils . md5Hex ( domain + nonce ) ; }
Create opaque .
18,302
public static String createAuthenticateHeader ( final String realm , final String authMethod , final String nonce ) { val stringBuilder = new StringBuilder ( "Digest realm=\"" ) . append ( realm ) . append ( "\"," ) ; if ( StringUtils . isNotBlank ( authMethod ) ) { stringBuilder . append ( "qop=" ) . append ( authMeth...
Create authenticate header containing the realm nonce opaque etc .
18,303
public WebEndpointResponse < Resource > exportServices ( ) throws Exception { val date = new SimpleDateFormat ( "yyyy-MM-dd-HH-mm" ) . format ( new Date ( ) ) ; val file = File . createTempFile ( "services-" + date , ".zip" ) ; Files . deleteIfExists ( file . toPath ( ) ) ; val env = new HashMap < String , Object > ( )...
Export services web endpoint response .
18,304
public Service buildService ( final OAuthRegisteredService registeredService , final J2EContext context , final boolean useServiceHeader ) { var id = StringUtils . EMPTY ; if ( useServiceHeader ) { id = OAuth20Utils . getServiceRequestHeaderIfAny ( context . getRequest ( ) ) ; LOGGER . debug ( "Located service based on...
Build service .
18,305
public Authentication build ( final UserProfile profile , final OAuthRegisteredService registeredService , final J2EContext context , final Service service ) { val profileAttributes = CoreAuthenticationUtils . convertAttributeValuesToMultiValuedObjects ( profile . getAttributes ( ) ) ; val newPrincipal = this . princip...
Create an authentication from a user profile .
18,306
protected void configureEndpointAccessToDenyUndefined ( final HttpSecurity http , final ExpressionUrlAuthorizationConfigurer < HttpSecurity > . ExpressionInterceptUrlRegistry requests ) { val endpoints = casProperties . getMonitor ( ) . getEndpoints ( ) . getEndpoint ( ) . keySet ( ) ; val endpointDefaults = casPropert...
Configure endpoint access to deny undefined .
18,307
protected void configureJdbcAuthenticationProvider ( final AuthenticationManagerBuilder auth , final MonitorProperties . Endpoints . JdbcSecurity jdbc ) throws Exception { val cfg = auth . jdbcAuthentication ( ) ; cfg . usersByUsernameQuery ( jdbc . getQuery ( ) ) ; cfg . rolePrefix ( jdbc . getRolePrefix ( ) ) ; cfg ....
Configure jdbc authentication provider .
18,308
protected void configureLdapAuthenticationProvider ( final AuthenticationManagerBuilder auth , final MonitorProperties . Endpoints . LdapSecurity ldap ) { if ( isLdapAuthorizationActive ( ) ) { val p = new MonitorEndpointLdapAuthenticationProvider ( ldap , securityProperties ) ; auth . authenticationProvider ( p ) ; } ...
Configure ldap authentication provider .
18,309
protected void configureJaasAuthenticationProvider ( final AuthenticationManagerBuilder auth , final MonitorProperties . Endpoints . JaasSecurity jaas ) throws Exception { val p = new JaasAuthenticationProvider ( ) ; p . setLoginConfig ( jaas . getLoginConfig ( ) ) ; p . setLoginContextName ( jaas . getLoginContextName...
Configure jaas authentication provider .
18,310
protected void configureEndpointAccessForStaticResources ( final ExpressionUrlAuthorizationConfigurer < HttpSecurity > . ExpressionInterceptUrlRegistry requests ) { requests . requestMatchers ( PathRequest . toStaticResources ( ) . atCommonLocations ( ) ) . permitAll ( ) ; requests . antMatchers ( "/resources/**" ) . p...
Configure endpoint access for static resources .
18,311
protected void configureEndpointAccessByFormLogin ( final ExpressionUrlAuthorizationConfigurer < HttpSecurity > . ExpressionInterceptUrlRegistry requests ) throws Exception { requests . and ( ) . formLogin ( ) . loginPage ( ENDPOINT_URL_ADMIN_FORM_LOGIN ) . permitAll ( ) ; }
Configure endpoint access by form login .
18,312
protected void configureEndpointAccess ( final HttpSecurity httpSecurity , final ExpressionUrlAuthorizationConfigurer < HttpSecurity > . ExpressionInterceptUrlRegistry requests , final ActuatorEndpointProperties . EndpointAccessLevel access , final ActuatorEndpointProperties properties , final EndpointRequest . Endpoin...
Configure endpoint access .
18,313
public static Map < String , Object > getSystemInfo ( ) { val properties = System . getProperties ( ) ; val info = new LinkedHashMap < String , Object > ( SYSTEM_INFO_DEFAULT_SIZE ) ; info . put ( "CAS Version" , StringUtils . defaultString ( CasVersion . getVersion ( ) , "Not Available" ) ) ; info . put ( "CAS Commit ...
Gets system info .
18,314
public static String getErrorMessage ( final com . authy . api . Error err ) { val builder = new StringBuilder ( ) ; if ( err != null ) { builder . append ( "Authy Error" ) ; if ( StringUtils . isNotBlank ( err . getCountryCode ( ) ) ) { builder . append ( ": Country Code: " ) . append ( err . getCountryCode ( ) ) ; } ...
Gets authy error message .
18,315
public User getOrCreateUser ( final Principal principal ) { val attributes = principal . getAttributes ( ) ; if ( ! attributes . containsKey ( this . mailAttribute ) ) { throw new IllegalArgumentException ( "No email address found for " + principal . getId ( ) ) ; } if ( ! attributes . containsKey ( this . phoneAttribu...
Gets or create user .
18,316
private static String getJasyptParamFromEnv ( final Environment environment , final JasyptEncryptionParameters param ) { return environment . getProperty ( param . getPropertyName ( ) , param . getDefaultValue ( ) ) ; }
Gets jasypt param from env .
18,317
public void setAlgorithm ( final String alg ) { if ( StringUtils . isNotBlank ( alg ) ) { LOGGER . debug ( "Configured Jasypt algorithm [{}]" , alg ) ; jasyptInstance . setAlgorithm ( alg ) ; } }
Sets algorithm .
18,318
public void setPassword ( final String psw ) { if ( StringUtils . isNotBlank ( psw ) ) { LOGGER . debug ( "Configured Jasypt password" ) ; jasyptInstance . setPassword ( psw ) ; } }
Sets password .
18,319
public void setKeyObtentionIterations ( final String iter ) { if ( StringUtils . isNotBlank ( iter ) && NumberUtils . isCreatable ( iter ) ) { LOGGER . debug ( "Configured Jasypt iterations" ) ; jasyptInstance . setKeyObtentionIterations ( Integer . parseInt ( iter ) ) ; } }
Sets key obtention iterations .
18,320
public void setProviderName ( final String pName ) { if ( StringUtils . isNotBlank ( pName ) ) { LOGGER . debug ( "Configured Jasypt provider" ) ; this . jasyptInstance . setProviderName ( pName ) ; } }
Sets provider name .
18,321
public String encryptValue ( final String value ) { try { return encryptValuePropagateExceptions ( value ) ; } catch ( final Exception e ) { LOGGER . error ( "Could not encrypt value [{}]" , value , e ) ; } return null ; }
Encrypt value string .
18,322
public String decryptValue ( final String value ) { try { return decryptValuePropagateExceptions ( value ) ; } catch ( final Exception e ) { LOGGER . error ( "Could not decrypt value [{}]" , value , e ) ; } return null ; }
Decrypt value string .
18,323
@ ShellMethod ( key = "list-undocumented" , value = "List all CAS undocumented properties." ) public void listUndocumented ( ) { val repository = new CasConfigurationMetadataRepository ( ) ; repository . getRepository ( ) . getAllProperties ( ) . entrySet ( ) . stream ( ) . filter ( p -> p . getKey ( ) . startsWith ( "...
List undocumented settings .
18,324
public static String buildKey ( final RegisteredService service ) { return service . getId ( ) + ";" + service . getName ( ) + ';' + service . getServiceId ( ) ; }
Gets key .
18,325
public static void preparePeerEntitySamlEndpointContext ( final RequestAbstractType request , final MessageContext outboundContext , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final String binding ) throws SamlException { val entityId = adaptor . getEntityId ( ) ; if ( ! adaptor . containsAssert...
Prepare peer entity saml endpoint .
18,326
public static Endpoint determineEndpointForRequest ( final RequestAbstractType authnRequest , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final String binding ) { var endpoint = ( Endpoint ) null ; if ( authnRequest instanceof LogoutRequest ) { endpoint = adaptor . getSingleLogoutService ( bindin...
Determine assertion consumer service assertion consumer service .
18,327
@ SuppressFBWarnings ( "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" ) public static MetadataResolver getMetadataResolverForAllSamlServices ( final ServicesManager servicesManager , final String entityID , final SamlRegisteredServiceCachingMetadataResolver resolver ) { val registeredServices = servicesManager . findServiceBy ...
Gets chaining metadata resolver for all saml services .
18,328
public static AssertionConsumerService getAssertionConsumerServiceFor ( final AuthnRequest authnRequest , final ServicesManager servicesManager , final SamlRegisteredServiceCachingMetadataResolver resolver ) { try { val acs = new AssertionConsumerServiceBuilder ( ) . buildObject ( ) ; if ( authnRequest . getAssertionCo...
Gets assertion consumer service for .
18,329
public static String getIssuerFromSamlObject ( final SAMLObject object ) { if ( object instanceof RequestAbstractType ) { return RequestAbstractType . class . cast ( object ) . getIssuer ( ) . getValue ( ) ; } if ( object instanceof StatusResponseType ) { return StatusResponseType . class . cast ( object ) . getIssuer ...
Gets issuer from saml object .
18,330
protected X509CRL fetchCRLFromLdap ( final Object r ) throws CertificateException , IOException , CRLException { try { val ldapURL = r . toString ( ) ; LOGGER . debug ( "Fetching CRL from ldap [{}]" , ldapURL ) ; val result = performLdapSearch ( ldapURL ) ; if ( result . getResultCode ( ) == ResultCode . SUCCESS ) { va...
Downloads a CRL from given LDAP url .
18,331
protected X509CRL fetchX509CRLFromAttribute ( final LdapAttribute aval ) throws CertificateException , IOException , CRLException { if ( aval != null && aval . isBinary ( ) ) { val val = aval . getBinaryValue ( ) ; if ( val == null || val . length == 0 ) { throw new CertificateException ( "Empty attribute. Can not down...
Gets x509 cRL from attribute . Retrieves the binary attribute value decodes it to base64 and fetches it as a byte - array resource .
18,332
protected Response < SearchResult > performLdapSearch ( final String ldapURL ) throws LdapException { val connectionFactory = prepareConnectionFactory ( ldapURL ) ; return this . searchExecutor . search ( connectionFactory ) ; }
Executes an LDAP search against the supplied URL .
18,333
protected ConnectionFactory prepareConnectionFactory ( final String ldapURL ) { val cc = ConnectionConfig . newConnectionConfig ( this . connectionConfig ) ; cc . setLdapUrl ( ldapURL ) ; return new DefaultConnectionFactory ( cc ) ; }
Prepare a new LDAP connection .
18,334
public T getProvider ( final String id ) { return ( T ) beanFactory . getBean ( providerFactory . beanName ( id ) ) ; }
Returns the provider assigned to the passed id .
18,335
public static IPersonAttributeDao newStubAttributeRepository ( final PrincipalAttributesProperties p ) { val dao = new NamedStubPersonAttributeDao ( ) ; val pdirMap = new LinkedHashMap < String , List < Object > > ( ) ; val stub = p . getStub ( ) ; stub . getAttributes ( ) . forEach ( ( key , value ) -> { val vals = St...
New attribute repository person attribute dao .
18,336
public static Duration newDuration ( final String length ) { if ( NumberUtils . isCreatable ( length ) ) { return Duration . ofSeconds ( Long . parseLong ( length ) ) ; } return Duration . parse ( length ) ; }
New duration . If the provided length is duration it will be parsed accordingly or if it s a numeric value it will be pared as a duration assuming it s provided as seconds .
18,337
public static String getGrouperGroupAttribute ( final GrouperGroupField groupField , final WsGroup group ) { switch ( groupField ) { case DISPLAY_EXTENSION : return group . getDisplayExtension ( ) ; case DISPLAY_NAME : return group . getDisplayName ( ) ; case EXTENSION : return group . getExtension ( ) ; case NAME : de...
Construct grouper group attribute . This is the name of every individual group attribute transformed into a CAS attribute value .
18,338
public Collection < WsGetGroupsResult > getGroupsForSubjectId ( final String subjectId ) { try { val groupsClient = new GcGetGroups ( ) . addSubjectId ( subjectId ) ; val results = groupsClient . execute ( ) . getResults ( ) ; if ( results == null || results . length == 0 ) { LOGGER . warn ( "Subject id [{}] could not ...
Gets groups for subject id .
18,339
public BaseHttpServletRequestXMLMessageDecoder getInstance ( final HttpMethod method ) { val decoder = get ( method ) ; return ( BaseHttpServletRequestXMLMessageDecoder ) BeanUtils . cloneBean ( decoder ) ; }
Gets a cloned instance of the decoder . Decoders are initialized once at configuration and then re - created on demand so they can initialized via OpenSAML again for new incoming requests .
18,340
@ View ( name = "by_uid_otp" , map = "function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }" ) public CouchDbGoogleAuthenticatorToken findOneByUidForOtp ( final String uid , final Integer otp ) { val view = createQuery ( "by_uid_otp" ) . key ( ComplexKey . of ( uid , otp ) ) . limit ( 1 )...
Find first by uid otp pair .
18,341
@ View ( name = "by_issued_date_time" , map = "function(doc) { if(doc.token && doc.userId) { emit(doc.issuedDateTime, doc) } }" ) public Collection < CouchDbGoogleAuthenticatorToken > findByIssuedDateTimeBefore ( final LocalDateTime localDateTime ) { val view = createQuery ( "by_issued_date_time" ) . endKey ( localDate...
Find by issued date .
18,342
@ View ( name = "by_userId" , map = "function(doc) { if(doc.token && doc.userId) { emit(doc.userId, doc) } }" ) public List < CouchDbGoogleAuthenticatorToken > findByUserId ( final String userId ) { return queryView ( "by_userId" , userId ) ; }
Find tokens by user id .
18,343
@ View ( name = "count_by_userId" , map = "function(doc) { if(doc.token && doc.userId) { emit(doc.userId, doc) } }" , reduce = "_count" ) public long countByUserId ( final String userId ) { val view = createQuery ( "count_by_userId" ) . key ( userId ) ; val rows = db . queryView ( view ) . getRows ( ) ; if ( rows . isE...
Token count for a user .
18,344
@ View ( name = "count" , map = "function(doc) { if(doc.token && doc.userId) { emit(doc._id, doc) } }" , reduce = "_count" ) public long count ( ) { val rows = db . queryView ( createQuery ( "count" ) ) . getRows ( ) ; if ( rows . isEmpty ( ) ) { return 0 ; } return rows . get ( 0 ) . getValueAsInt ( ) ; }
Total number of tokens stored .
18,345
@ UpdateHandler ( name = "delete_token" , file = "CouchDbOneTimeToken_delete.js" ) public void deleteToken ( final CouchDbGoogleAuthenticatorToken token ) { db . callUpdateHandler ( stdDesignDocumentId , "delete_token" , token . getCid ( ) , null ) ; }
Delete record ignoring rev .
18,346
@ View ( name = "by_uid_otp" , map = "function(doc) { if(doc.token && doc.userId) { emit([doc.userId, doc.token], doc) } }" ) public List < CouchDbGoogleAuthenticatorToken > findByUidForOtp ( final String uid , final Integer otp ) { val view = createQuery ( "by_uid_otp" ) . key ( ComplexKey . of ( uid , otp ) ) ; retur...
Find all by uid otp pair .
18,347
@ View ( name = "by_token" , map = "function(doc) { if(doc.token && doc.userId) { emit(doc.token, doc) } }" ) public List < CouchDbGoogleAuthenticatorToken > findByToken ( final Integer otp ) { return queryView ( "by_token" , otp ) ; }
Find by token .
18,348
protected String getJwtId ( final TicketGrantingTicket tgt ) { val oAuthCallbackUrl = getConfigurationContext ( ) . getCasProperties ( ) . getServer ( ) . getPrefix ( ) + OAuth20Constants . BASE_OAUTH20_URL + '/' + OAuth20Constants . CALLBACK_AUTHORIZE_URL_DEFINITION ; val oAuthServiceTicket = Stream . concat ( tgt . g...
Gets oauth service ticket .
18,349
protected String generateAccessTokenHash ( final AccessToken accessTokenId , final OidcRegisteredService service ) { val alg = getConfigurationContext ( ) . getIdTokenSigningAndEncryptionService ( ) . getJsonWebKeySigningAlgorithm ( service ) ; val tokenBytes = accessTokenId . getId ( ) . getBytes ( StandardCharsets . ...
Generate access token hash string .
18,350
protected String getSigningHashAlgorithm ( final OidcRegisteredService service ) { val alg = getConfigurationContext ( ) . getIdTokenSigningAndEncryptionService ( ) . getJsonWebKeySigningAlgorithm ( service ) ; LOGGER . debug ( "Signing algorithm specified by service [{}] is [{}]" , service . getServiceId ( ) , alg ) ;...
Gets signing hash algorithm .
18,351
public Map < String , Object > handle ( final String username , final String password , final String service ) { val selectedService = this . serviceFactory . createService ( service ) ; val registeredService = this . servicesManager . findServiceBy ( selectedService ) ; val credential = new UsernamePasswordCredential ...
Handle validation request and produce saml1 payload .
18,352
private CloseableHttpClient buildHttpClient ( ) { val plainSocketFactory = PlainConnectionSocketFactory . getSocketFactory ( ) ; val registry = RegistryBuilder . < ConnectionSocketFactory > create ( ) . register ( "http" , plainSocketFactory ) . register ( "https" , this . sslSocketFactory ) . build ( ) ; val connectio...
Build a HTTP client based on the current properties .
18,353
protected String getAlternatePrincipal ( final X509Certificate certificate ) { if ( alternatePrincipalAttribute == null ) { return null ; } val attributes = extractPersonAttributes ( certificate ) ; val attribute = attributes . get ( alternatePrincipalAttribute ) ; if ( attribute == null ) { LOGGER . debug ( "Attempt t...
Get alternate principal if alternate attribute configured .
18,354
protected Map < String , List < Object > > extractPersonAttributes ( final X509Certificate certificate ) { val attributes = new LinkedHashMap < String , List < Object > > ( ) ; if ( certificate != null ) { if ( StringUtils . isNotBlank ( certificate . getSigAlgOID ( ) ) ) { attributes . put ( "sigAlgOid" , CollectionUt...
Get additional attributes from the certificate .
18,355
protected String getRFC822EmailAddress ( final Collection < List < ? > > subjectAltNames ) { if ( subjectAltNames == null ) { return null ; } Optional < List < ? > > email = subjectAltNames . stream ( ) . filter ( s -> s . size ( ) == 2 && ( Integer ) s . get ( 0 ) == SAN_RFC822_EMAIL_TYPE ) . findFirst ( ) ; return em...
Get Email Address .
18,356
public CouchDbSamlIdPMetadataDocument merge ( final SamlIdPMetadataDocument doc ) { setId ( doc . getId ( ) ) ; setMetadata ( doc . getMetadata ( ) ) ; setSigningCertificate ( doc . getSigningCertificate ( ) ) ; setSigningKey ( doc . getSigningKey ( ) ) ; setEncryptionCertificate ( doc . getEncryptionCertificate ( ) ) ...
Merge another doc into this one .
18,357
protected void registerMultifactorFlowDefinitionIntoLoginFlowRegistry ( final FlowDefinitionRegistry sourceRegistry ) { val flowIds = sourceRegistry . getFlowDefinitionIds ( ) ; for ( val flowId : flowIds ) { val definition = sourceRegistry . getFlowDefinition ( flowId ) ; if ( definition != null ) { LOGGER . trace ( "...
Register flow definition into login flow registry .
18,358
protected void augmentMultifactorProviderFlowRegistry ( final FlowDefinitionRegistry mfaProviderFlowRegistry ) { val flowIds = mfaProviderFlowRegistry . getFlowDefinitionIds ( ) ; Arrays . stream ( flowIds ) . forEach ( id -> { val flow = ( Flow ) mfaProviderFlowRegistry . getFlowDefinition ( id ) ; if ( flow != null &...
Augment mfa provider flow registry .
18,359
protected void registerMultifactorTrustedAuthentication ( final FlowDefinitionRegistry flowDefinitionRegistry ) { validateFlowDefinitionConfiguration ( flowDefinitionRegistry ) ; LOGGER . debug ( "Flow definitions found in the registry are [{}]" , ( Object [ ] ) flowDefinitionRegistry . getFlowDefinitionIds ( ) ) ; val...
Register multifactor trusted authentication into webflow .
18,360
protected boolean shouldSkipInterruptForRegisteredService ( final RegisteredService registeredService ) { if ( registeredService != null ) { LOGGER . debug ( "Checking interrupt rules for service [{}]" , registeredService . getName ( ) ) ; if ( RegisteredServiceProperties . SKIP_INTERRUPT_NOTIFICATIONS . isAssignedTo (...
Should skip interrupt for registered service .
18,361
public static String sanitize ( final String msg ) { var modifiedMessage = msg ; if ( StringUtils . isNotBlank ( msg ) && ! Boolean . getBoolean ( "CAS_TICKET_ID_SANITIZE_SKIP" ) ) { val matcher = TICKET_ID_PATTERN . matcher ( msg ) ; while ( matcher . find ( ) ) { val match = matcher . group ( ) ; val group = matcher ...
Remove ticket id from the message .
18,362
protected Status status ( final CacheStatistics statistics ) { if ( statistics . getEvictions ( ) > 0 && statistics . getEvictions ( ) > evictionThreshold ) { return new Status ( "WARN" ) ; } if ( statistics . getPercentFree ( ) > 0 && statistics . getPercentFree ( ) < threshold ) { return Status . OUT_OF_SERVICE ; } r...
Computes the status code for a given set of cache statistics .
18,363
protected Event handleException ( final J2EContext webContext , final BaseClient < Credentials , CommonProfile > client , final Exception e ) { if ( e instanceof RequestSloException ) { try { webContext . getResponse ( ) . sendRedirect ( "logout" ) ; } catch ( final IOException ioe ) { throw new IllegalArgumentExceptio...
Handle the thrown exception .
18,364
protected Credentials getCredentialsFromDelegatedClient ( final J2EContext webContext , final BaseClient < Credentials , CommonProfile > client ) { val credentials = client . getCredentials ( webContext ) ; LOGGER . debug ( "Retrieved credentials from client as [{}]" , credentials ) ; if ( credentials == null ) { throw...
Gets credentials from delegated client .
18,365
protected BaseClient < Credentials , CommonProfile > findDelegatedClientByName ( final HttpServletRequest request , final String clientName , final Service service ) { val client = ( BaseClient < Credentials , CommonProfile > ) this . clients . findClient ( clientName ) ; LOGGER . debug ( "Delegated authentication clie...
Find delegated client by name base client .
18,366
protected void prepareForLoginPage ( final RequestContext context ) { val currentService = WebUtils . getService ( context ) ; val service = authenticationRequestServiceSelectionStrategies . resolveService ( currentService , WebApplicationService . class ) ; val request = WebUtils . getHttpServletRequestFromExternalWeb...
Prepare the data for the login page .
18,367
protected Optional < ProviderLoginPageConfiguration > buildProviderConfiguration ( final IndirectClient client , final WebContext webContext , final WebApplicationService service ) { val name = client . getName ( ) ; val matcher = PAC4J_CLIENT_SUFFIX_PATTERN . matcher ( client . getClass ( ) . getSimpleName ( ) ) ; val...
Build provider configuration optional .
18,368
protected String getCssClass ( final String name ) { var computedCssClass = "fa fa-lock" ; if ( StringUtils . isNotBlank ( name ) ) { computedCssClass = computedCssClass . concat ( ' ' + PAC4J_CLIENT_CSS_CLASS_SUBSTITUTION_PATTERN . matcher ( name ) . replaceAll ( "-" ) ) ; } LOGGER . debug ( "CSS class for [{}] is [{}...
Get a valid CSS class for the given provider name .
18,369
protected boolean isDelegatedClientAuthorizedForService ( final Client client , final Service service ) { if ( service == null || StringUtils . isBlank ( service . getId ( ) ) ) { LOGGER . debug ( "Can not evaluate delegated authentication policy since no service was provided in the request while processing client [{}]...
Is delegated client authorized for service boolean .
18,370
public static Optional < ModelAndView > hasDelegationRequestFailed ( final HttpServletRequest request , final int status ) { val params = request . getParameterMap ( ) ; if ( Stream . of ( "error" , "error_code" , "error_description" , "error_message" ) . anyMatch ( params :: containsKey ) ) { val model = new HashMap <...
Determine if request has errors .
18,371
public EncryptedID encode ( final NameID samlObject , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor ) { val encrypter = buildEncrypterForSamlObject ( samlObject , service , adaptor ) ; return encrypter . encrypt ( samlObject ) ; }
Encode encrypted id .
18,372
public EncryptedAttribute encode ( final Attribute samlObject , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor ) { val encrypter = buildEncrypterForSamlObject ( samlObject , service , adaptor ) ; return encrypter . encrypt ( samlObject ) ; }
Encode encrypted attribute .
18,373
protected Encrypter buildEncrypterForSamlObject ( final Object samlObject , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor ) { val className = samlObject . getClass ( ) . getName ( ) ; val entityId = adaptor . getEntityId ( ) ; LOGGER . debug ( "Attempting to encr...
Build encrypter for saml object encrypter .
18,374
protected Encrypter getEncrypter ( final Object samlObject , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final KeyEncryptionParameters keyEncParams , final DataEncryptionParameters dataEncParams ) { val encrypter = new Encrypter ( dataEncParams , keyEncParams...
Gets encrypter .
18,375
protected DataEncryptionParameters getDataEncryptionParameters ( final Object samlObject , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor ) { val dataEncParams = new DataEncryptionParameters ( ) ; dataEncParams . setAlgorithm ( EncryptionConstants . ALGO_ID_BLOCKC...
Gets data encryption parameters .
18,376
protected KeyEncryptionParameters getKeyEncryptionParameters ( final Object samlObject , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final Credential credential ) { val keyEncParams = new KeyEncryptionParameters ( ) ; keyEncParams . setRecipient ( adaptor . g...
Gets key encryption parameters .
18,377
protected Credential getKeyEncryptionCredential ( final String peerEntityId , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final SamlRegisteredService service ) throws Exception { val config = DefaultSecurityConfigurationBootstrap . buildDefaultEncryptionConfiguration ( ) ; val overrideDataEncrypt...
Gets key encryption credential .
18,378
@ GetMapping ( "/openid/*" ) protected ModelAndView handleRequestInternal ( final HttpServletRequest request , final HttpServletResponse response ) { return new ModelAndView ( "openIdProviderView" , CollectionUtils . wrap ( "openid_server" , casProperties . getServer ( ) . getPrefix ( ) ) ) ; }
Handle request internal model and view .
18,379
private static String normalizePath ( final Service service ) { var path = service . getId ( ) ; path = StringUtils . substringBefore ( path , "?" ) ; path = StringUtils . substringBefore ( path , ";" ) ; path = StringUtils . substringBefore ( path , "#" ) ; return path ; }
Normalize the path of a service by removing the query string and everything after a semi - colon .
18,380
protected void trackServiceSession ( final String id , final Service service , final boolean onlyTrackMostRecentSession ) { update ( ) ; service . setPrincipal ( getRoot ( ) . getAuthentication ( ) . getPrincipal ( ) . getId ( ) ) ; if ( onlyTrackMostRecentSession ) { val path = normalizePath ( service ) ; val existing...
Update service and track session .
18,381
public GeoLocationResponse addAddress ( final String address ) { if ( StringUtils . isNotBlank ( address ) ) { this . addresses . add ( address ) ; } return this ; }
Add address .
18,382
protected String getCurrentTheme ( ) { val request = WebUtils . getHttpServletRequestFromExternalWebflowContext ( ) ; if ( request != null ) { val session = request . getSession ( false ) ; val paramName = casProperties . getTheme ( ) . getParamName ( ) ; if ( session != null ) { return ( String ) session . getAttribut...
Gets current theme .
18,383
public int deleteAll ( ) { val count = new AtomicInteger ( ) ; val metadata = this . ticketCatalog . findAll ( ) ; metadata . forEach ( r -> { val scan = new ScanRequest ( r . getProperties ( ) . getStorageName ( ) ) ; LOGGER . debug ( "Submitting scan request [{}] to table [{}]" , scan , r . getProperties ( ) . getSto...
Delete all .
18,384
public Ticket get ( final String ticketId , final String encodedTicketId ) { val metadata = this . ticketCatalog . find ( ticketId ) ; if ( metadata != null ) { val keys = new HashMap < String , AttributeValue > ( ) ; keys . put ( ColumnNames . ID . getColumnName ( ) , new AttributeValue ( encodedTicketId ) ) ; val req...
Get ticket .
18,385
public void put ( final Ticket ticket , final Ticket encodedTicket ) { val metadata = this . ticketCatalog . find ( ticket ) ; val values = buildTableAttributeValuesMapFromTicket ( ticket , encodedTicket ) ; LOGGER . debug ( "Adding ticket id [{}] with attribute values [{}]" , encodedTicket . getId ( ) , values ) ; val...
Put ticket .
18,386
public void createTicketTables ( final boolean deleteTables ) { val metadata = this . ticketCatalog . findAll ( ) ; metadata . forEach ( Unchecked . consumer ( r -> { val request = new CreateTableRequest ( ) . withAttributeDefinitions ( new AttributeDefinition ( ColumnNames . ID . getColumnName ( ) , ScalarAttributeTyp...
Create ticket tables .
18,387
public Map < String , AttributeValue > buildTableAttributeValuesMapFromTicket ( final Ticket ticket , final Ticket encTicket ) { val values = new HashMap < String , AttributeValue > ( ) ; values . put ( ColumnNames . ID . getColumnName ( ) , new AttributeValue ( encTicket . getId ( ) ) ) ; values . put ( ColumnNames . ...
Build table attribute values from ticket map .
18,388
public static DefaultAuthenticationTransaction of ( final Service service , final Credential ... credentials ) { val creds = sanitizeCredentials ( credentials ) ; return new DefaultAuthenticationTransaction ( service , creds ) ; }
Wrap credentials into an authentication transaction as a factory method and return the final result .
18,389
private static Set < Credential > sanitizeCredentials ( final Credential [ ] credentials ) { if ( credentials != null && credentials . length > 0 ) { return Arrays . stream ( credentials ) . filter ( Objects :: nonNull ) . collect ( Collectors . toCollection ( LinkedHashSet :: new ) ) ; } return new HashSet < > ( 0 ) ;...
Sanitize credentials set . It s important to keep the order of the credentials in the final set as they were presented .
18,390
public void parseCompilationUnit ( final Set < ConfigurationMetadataProperty > collectedProps , final Set < ConfigurationMetadataProperty > collectedGroups , final ConfigurationMetadataProperty p , final String typePath , final String typeName , final boolean indexNameWithBrackets ) { try ( val is = Files . newInputStr...
Parse compilation unit .
18,391
protected String determineThemeNameToChoose ( final HttpServletRequest request , final Service service , final RegisteredService rService ) { HttpResponse response = null ; try { LOGGER . debug ( "Service [{}] is configured to use a custom theme [{}]" , rService , rService . getTheme ( ) ) ; val resource = ResourceUtil...
Determine theme name to choose .
18,392
protected String callRestEndpointForMultifactor ( final Principal principal , final Service resolvedService ) { val restTemplate = new RestTemplate ( ) ; val restEndpoint = casProperties . getAuthn ( ) . getMfa ( ) . getRestEndpoint ( ) ; val entity = new RestEndpointEntity ( principal . getId ( ) , resolvedService . g...
Call rest endpoint for multifactor .
18,393
protected boolean isAccessTokenExpired ( final TicketState ticketState ) { val currentSystemTime = ZonedDateTime . now ( ZoneOffset . UTC ) ; val creationTime = ticketState . getCreationTime ( ) ; var expirationTime = creationTime . plus ( this . maxTimeToLiveInSeconds , ChronoUnit . SECONDS ) ; if ( currentSystemTime ...
Is access token expired ? .
18,394
public static Set < String > getOidcPromptFromAuthorizationRequest ( final String url ) { return new URIBuilder ( url ) . getQueryParams ( ) . stream ( ) . filter ( p -> OidcConstants . PROMPT . equals ( p . getName ( ) ) ) . map ( param -> param . getValue ( ) . split ( " " ) ) . flatMap ( Arrays :: stream ) . collect...
Gets oidc prompt from authorization request .
18,395
public static Optional < Long > getOidcMaxAgeFromAuthorizationRequest ( final WebContext context ) { val builderContext = new URIBuilder ( context . getFullRequestURL ( ) ) ; val parameter = builderContext . getQueryParams ( ) . stream ( ) . filter ( p -> OidcConstants . MAX_AGE . equals ( p . getName ( ) ) ) . findFir...
Gets oidc max age from authorization request .
18,396
public static Optional < CommonProfile > isAuthenticationProfileAvailable ( final J2EContext context ) { val manager = new ProfileManager < > ( context , context . getSessionStore ( ) ) ; return manager . get ( true ) ; }
Is authentication profile available? .
18,397
public Optional < Authentication > isCasAuthenticationAvailable ( final WebContext context ) { val j2EContext = ( J2EContext ) context ; if ( j2EContext != null ) { val tgtId = ticketGrantingTicketCookieGenerator . retrieveCookieValue ( j2EContext . getRequest ( ) ) ; if ( StringUtils . isNotBlank ( tgtId ) ) { val aut...
Is cas authentication available?
18,398
public static boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest ( final WebContext context , final ZonedDateTime authenticationDate ) { val maxAge = getOidcMaxAgeFromAuthorizationRequest ( context ) ; if ( maxAge . isPresent ( ) && maxAge . get ( ) > 0 ) { val now = ZonedDateTime . now ( ZoneOffset . UTC ) . ...
Is cas authentication old for max age authorization request boolean .
18,399
public boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest ( final WebContext context ) { return isCasAuthenticationAvailable ( context ) . filter ( a -> isCasAuthenticationOldForMaxAgeAuthorizationRequest ( context , a ) ) . isPresent ( ) ; }
Is cas authentication available and old for max age authorization request?