idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
18,400
public static boolean isCasAuthenticationOldForMaxAgeAuthorizationRequest ( final WebContext context , final UserProfile profile ) { val authTime = profile . getAttribute ( CasProtocolConstants . VALIDATION_CAS_MODEL_ATTRIBUTE_NAME_AUTHENTICATION_DATE ) ; if ( authTime == null ) { return false ; } val dt = ZonedDateTim...
Is cas authentication old for max age authorization request?
18,401
@ Scheduled ( initialDelayString = "${cas.authn.throttle.schedule.startDelay:PT10S}" , fixedDelayString = "${cas.authn.throttle.schedule.repeatInterval:PT15S}" ) public void run ( ) { val handlers = authenticationThrottlingExecutionPlan . getAuthenticationThrottleInterceptors ( ) ; handlers . stream ( ) . filter ( hand...
Kicks off the job that attempts to clean the throttling submission record history .
18,402
protected void createLoginFormView ( final Flow flow ) { val propertiesToBind = CollectionUtils . wrapList ( "username" , "password" , "source" ) ; val binder = createStateBinderConfiguration ( propertiesToBind ) ; casProperties . getView ( ) . getCustomLoginFormFields ( ) . forEach ( ( field , props ) -> { val fieldNa...
Create login form view .
18,403
protected void createAuthenticationWarningMessagesView ( final Flow flow ) { val state = createViewState ( flow , CasWebflowConstants . STATE_ID_SHOW_AUTHN_WARNING_MSGS , "casLoginMessageView" ) ; val setAction = createSetAction ( "requestScope.messages" , "messageContext.allMessages" ) ; state . getEntryActionList ( )...
Create authentication warning messages view .
18,404
protected void createRememberMeAuthnWebflowConfig ( final Flow flow ) { if ( casProperties . getTicket ( ) . getTgt ( ) . getRememberMe ( ) . isEnabled ( ) ) { createFlowVariable ( flow , CasWebflowConstants . VAR_ID_CREDENTIAL , RememberMeUsernamePasswordCredential . class ) ; val state = getState ( flow , CasWebflowC...
Create remember me authn webflow config .
18,405
protected void createDefaultActionStates ( final Flow flow ) { createRealSubmitAction ( flow ) ; createInitialAuthenticationRequestValidationCheckAction ( flow ) ; createCreateTicketGrantingTicketAction ( flow ) ; createSendTicketGrantingTicketAction ( flow ) ; createGenerateServiceTicketAction ( flow ) ; createGateway...
Create default action states .
18,406
protected void createRealSubmitAction ( final Flow flow ) { val state = createActionState ( flow , CasWebflowConstants . STATE_ID_REAL_SUBMIT , "authenticationViaFormAction" ) ; createTransitionForState ( state , CasWebflowConstants . TRANSITION_ID_WARN , CasWebflowConstants . STATE_ID_WARN ) ; createTransitionForState...
Create real submit action .
18,407
protected void createTicketGrantingTicketCheckAction ( final Flow flow ) { val action = createActionState ( flow , CasWebflowConstants . STATE_ID_TICKET_GRANTING_TICKET_CHECK , CasWebflowConstants . ACTION_ID_TICKET_GRANTING_TICKET_CHECK ) ; createTransitionForState ( action , CasWebflowConstants . TRANSITION_ID_TGT_NO...
Create ticket granting ticket check action .
18,408
protected void createInitialAuthenticationRequestValidationCheckAction ( final Flow flow ) { val action = createActionState ( flow , CasWebflowConstants . STATE_ID_INITIAL_AUTHN_REQUEST_VALIDATION_CHECK , CasWebflowConstants . ACTION_ID_INITIAL_AUTHN_REQUEST_VALIDATION ) ; createTransitionForState ( action , CasWebflow...
Create initial authentication request validation check action .
18,409
protected void createTerminateSessionAction ( final Flow flow ) { val terminateSession = createActionState ( flow , CasWebflowConstants . STATE_ID_TERMINATE_SESSION , createEvaluateAction ( CasWebflowConstants . ACTION_ID_TERMINATE_SESSION ) ) ; createStateDefaultTransition ( terminateSession , CasWebflowConstants . ST...
Create terminate session action .
18,410
protected void createSendTicketGrantingTicketAction ( final Flow flow ) { val action = createActionState ( flow , CasWebflowConstants . STATE_ID_SEND_TICKET_GRANTING_TICKET , CasWebflowConstants . ACTION_ID_SEND_TICKET_GRANTING_TICKET ) ; createTransitionForState ( action , CasWebflowConstants . TRANSITION_ID_SUCCESS ,...
Create send ticket granting ticket action .
18,411
protected void createCreateTicketGrantingTicketAction ( final Flow flow ) { val action = createActionState ( flow , CasWebflowConstants . STATE_ID_CREATE_TICKET_GRANTING_TICKET , CasWebflowConstants . ACTION_ID_CREATE_TICKET_GRANTING_TICKET ) ; createTransitionForState ( action , CasWebflowConstants . TRANSITION_ID_SUC...
Create create ticket granting ticket action .
18,412
protected void createGenerateServiceTicketAction ( final Flow flow ) { val handler = createActionState ( flow , CasWebflowConstants . STATE_ID_GENERATE_SERVICE_TICKET , createEvaluateAction ( CasWebflowConstants . ACTION_ID_GENERATE_SERVICE_TICKET ) ) ; createTransitionForState ( handler , CasWebflowConstants . TRANSIT...
Create generate service ticket action .
18,413
protected void createHandleAuthenticationFailureAction ( final Flow flow ) { val handler = createActionState ( flow , CasWebflowConstants . STATE_ID_HANDLE_AUTHN_FAILURE , CasWebflowConstants . ACTION_ID_AUTHENTICATION_EXCEPTION_HANDLER ) ; createTransitionForState ( handler , AccountDisabledException . class . getSimp...
Create handle authentication failure action .
18,414
protected void createRedirectToServiceActionState ( final Flow flow ) { val redirectToView = createActionState ( flow , CasWebflowConstants . STATE_ID_REDIRECT , CasWebflowConstants . ACTION_ID_REDIRECT_TO_SERVICE ) ; createTransitionForState ( redirectToView , Response . ResponseType . POST . name ( ) . toLowerCase ( ...
Create redirect to service action state .
18,415
protected void createServiceAuthorizationCheckAction ( final Flow flow ) { val serviceAuthorizationCheck = createActionState ( flow , CasWebflowConstants . STATE_ID_SERVICE_AUTHZ_CHECK , "serviceAuthorizationCheck" ) ; createStateDefaultTransition ( serviceAuthorizationCheck , CasWebflowConstants . STATE_ID_INIT_LOGIN_...
Create service authorization check action .
18,416
protected void createGatewayServicesMgmtAction ( final Flow flow ) { val gatewayServicesManagementCheck = createActionState ( flow , CasWebflowConstants . STATE_ID_GATEWAY_SERVICES_MGMT_CHECK , "gatewayServicesManagementCheck" ) ; createTransitionForState ( gatewayServicesManagementCheck , CasWebflowConstants . STATE_I...
Create gateway services mgmt action .
18,417
protected void createInjectHeadersActionState ( final Flow flow ) { val headerState = createActionState ( flow , CasWebflowConstants . STATE_ID_HEADER_VIEW , "injectResponseHeadersAction" ) ; createTransitionForState ( headerState , CasWebflowConstants . TRANSITION_ID_SUCCESS , CasWebflowConstants . STATE_ID_END_WEBFLO...
Create header end state .
18,418
protected void createRedirectUnauthorizedServiceUrlEndState ( final Flow flow ) { val state = createEndState ( flow , CasWebflowConstants . STATE_ID_VIEW_REDIR_UNAUTHZ_URL , "flowScope.unauthorizedRedirectUrl" , true ) ; state . getEntryActionList ( ) . add ( createEvaluateAction ( "redirectUnauthorizedServiceUrlAction...
Create redirect unauthorized service url end state .
18,419
protected void createGenericLoginSuccessEndState ( final Flow flow ) { val state = createEndState ( flow , CasWebflowConstants . STATE_ID_VIEW_GENERIC_LOGIN_SUCCESS , CasWebflowConstants . VIEW_ID_GENERIC_SUCCESS ) ; state . getEntryActionList ( ) . add ( createEvaluateAction ( "genericSuccessViewAction" ) ) ; }
Create generic login success end state .
18,420
protected void createServiceWarningViewState ( final Flow flow ) { val stateWarning = createViewState ( flow , CasWebflowConstants . STATE_ID_SHOW_WARNING_VIEW , CasWebflowConstants . VIEW_ID_CONFIRM ) ; createTransitionForState ( stateWarning , CasWebflowConstants . TRANSITION_ID_SUCCESS , "finalizeWarning" ) ; val fi...
Create service warning view state .
18,421
protected void createDefaultDecisionStates ( final Flow flow ) { createServiceUnauthorizedCheckDecisionState ( flow ) ; createServiceCheckDecisionState ( flow ) ; createWarnDecisionState ( flow ) ; createGatewayRequestCheckDecisionState ( flow ) ; createHasServiceCheckDecisionState ( flow ) ; createRenewCheckActionStat...
Create default decision states .
18,422
protected void createServiceUnauthorizedCheckDecisionState ( final Flow flow ) { val decision = createDecisionState ( flow , CasWebflowConstants . STATE_ID_SERVICE_UNAUTHZ_CHECK , "flowScope.unauthorizedRedirectUrl != null" , CasWebflowConstants . STATE_ID_VIEW_REDIR_UNAUTHZ_URL , CasWebflowConstants . STATE_ID_VIEW_SE...
Create service unauthorized check decision state .
18,423
protected void createServiceCheckDecisionState ( final Flow flow ) { createDecisionState ( flow , CasWebflowConstants . STATE_ID_SERVICE_CHECK , "flowScope.service != null" , CasWebflowConstants . STATE_ID_GENERATE_SERVICE_TICKET , CasWebflowConstants . STATE_ID_VIEW_GENERIC_LOGIN_SUCCESS ) ; }
Create service check decision state .
18,424
protected void createWarnDecisionState ( final Flow flow ) { createDecisionState ( flow , CasWebflowConstants . STATE_ID_WARN , "flowScope.warnCookieValue" , CasWebflowConstants . STATE_ID_SHOW_WARNING_VIEW , CasWebflowConstants . STATE_ID_REDIRECT ) ; }
Create warn decision state .
18,425
protected void createGatewayRequestCheckDecisionState ( final Flow flow ) { createDecisionState ( flow , CasWebflowConstants . STATE_ID_GATEWAY_REQUEST_CHECK , "requestParameters.gateway != '' and requestParameters.gateway != null and flowScope.service != null" , CasWebflowConstants . STATE_ID_GATEWAY_SERVICES_MGMT_CHE...
Create gateway request check decision state .
18,426
protected void createHasServiceCheckDecisionState ( final Flow flow ) { createDecisionState ( flow , CasWebflowConstants . STATE_ID_HAS_SERVICE_CHECK , "flowScope.service != null" , CasWebflowConstants . STATE_ID_RENEW_REQUEST_CHECK , CasWebflowConstants . STATE_ID_VIEW_GENERIC_LOGIN_SUCCESS ) ; }
Create has service check decision state .
18,427
protected void createRenewCheckActionState ( final Flow flow ) { val action = createActionState ( flow , CasWebflowConstants . STATE_ID_RENEW_REQUEST_CHECK , CasWebflowConstants . ACTION_ID_RENEW_AUTHN_REQUEST ) ; createTransitionForState ( action , CasWebflowConstants . TRANSITION_ID_PROCEED , CasWebflowConstants . ST...
Create renew check state .
18,428
public String getNewTicketId ( final String prefix ) { val number = this . numericGenerator . getNextNumberAsString ( ) ; val ticketBody = this . randomStringGenerator . getNewString ( ) . replace ( '_' , '-' ) ; val origSuffix = StringUtils . defaultString ( this . suffix ) ; val finalizedSuffix = StringUtils . isEmpt...
Due to a bug in mod - auth - cas and possibly other clients in the way tickets are parsed the ticket id body is sanitized to remove the character _ replacing it with - instead . This might be revisited in the future and removed once at least mod - auth - cas fixes the issue .
18,429
public boolean isUndefined ( ) { return StringUtils . isBlank ( text ) || StringUtils . isBlank ( from ) || StringUtils . isBlank ( subject ) ; }
Indicate whether email settings are defined .
18,430
public String getFormattedBody ( final Object ... arguments ) { if ( StringUtils . isBlank ( this . text ) ) { LOGGER . warn ( "No email body is defined" ) ; return StringUtils . EMPTY ; } try { val templateFile = ResourceUtils . getFile ( this . text ) ; val contents = FileUtils . readFileToString ( templateFile , Sta...
Format body .
18,431
private Collection < Map < String , Object > > getActiveSsoSessions ( final SsoSessionReportOptions option ) { val activeSessions = new ArrayList < Map < String , Object > > ( ) ; val dateFormat = new ISOStandardDateFormat ( ) ; getNonExpiredTicketGrantingTickets ( ) . stream ( ) . map ( TicketGrantingTicket . class ::...
Gets sso sessions .
18,432
private Collection < Ticket > getNonExpiredTicketGrantingTickets ( ) { return this . centralAuthenticationService . getTickets ( ticket -> ticket instanceof TicketGrantingTicket && ! ticket . isExpired ( ) ) ; }
Gets non expired ticket granting tickets .
18,433
public Map < String , Object > getSsoSessions ( final String type ) { val sessionsMap = new HashMap < String , Object > ( 1 ) ; val option = SsoSessionReportOptions . valueOf ( type ) ; val activeSsoSessions = getActiveSsoSessions ( option ) ; sessionsMap . put ( "activeSsoSessions" , activeSsoSessions ) ; val totalTic...
Endpoint for getting SSO Sessions in JSON format .
18,434
public Map < String , Object > destroySsoSession ( final String ticketGrantingTicket ) { val sessionsMap = new HashMap < String , Object > ( 1 ) ; try { this . centralAuthenticationService . destroyTicketGrantingTicket ( ticketGrantingTicket ) ; sessionsMap . put ( STATUS , HttpServletResponse . SC_OK ) ; sessionsMap ....
Endpoint for destroying a single SSO Session .
18,435
public Map < String , Object > destroySsoSessions ( final String type ) { val sessionsMap = new HashMap < String , Object > ( ) ; val failedTickets = new HashMap < String , String > ( ) ; val option = SsoSessionReportOptions . valueOf ( type ) ; val collection = getActiveSsoSessions ( option ) ; collection . stream ( )...
Destroy sso sessions map .
18,436
public boolean isValid ( ) { return StringUtils . isNotBlank ( this . latitude ) && StringUtils . isNotBlank ( this . longitude ) && StringUtils . isNotBlank ( this . accuracy ) && StringUtils . isNotBlank ( this . timestamp ) ; }
Check whether the geolocation contains enough data to proceed .
18,437
@ ReadOperation ( produces = { ActuatorMediaType . V2_JSON , "application/vnd.cas.services+yaml" , MediaType . APPLICATION_JSON_VALUE } ) public Collection < RegisteredService > handle ( ) { return this . servicesManager . load ( ) ; }
Handle and produce a list of services from registry .
18,438
@ ReadOperation ( produces = { ActuatorMediaType . V2_JSON , "application/vnd.cas.services+yaml" , MediaType . APPLICATION_JSON_VALUE } ) public RegisteredService fetchService ( final String id ) { if ( NumberUtils . isDigits ( id ) ) { return this . servicesManager . findServiceBy ( Long . parseLong ( id ) ) ; } retur...
Fetch service either by numeric id or service id pattern .
18,439
@ DeleteOperation ( produces = { ActuatorMediaType . V2_JSON , "application/vnd.cas.services+yaml" , MediaType . APPLICATION_JSON_VALUE } ) public RegisteredService deleteService ( final String id ) { if ( NumberUtils . isDigits ( id ) ) { val svc = this . servicesManager . findServiceBy ( Long . parseLong ( id ) ) ; i...
Delete registered service .
18,440
protected SamlRegisteredService verifySamlRegisteredService ( final String serviceId ) { if ( StringUtils . isBlank ( serviceId ) ) { throw new UnauthorizedServiceException ( UnauthorizedServiceException . CODE_UNAUTHZ_SERVICE , "Could not verify/locate SAML registered service since no serviceId is provided" ) ; } LOGG...
Gets registered service and verify .
18,441
protected AuthnRequest retrieveSamlAuthenticationRequestFromHttpRequest ( final HttpServletRequest request ) throws Exception { LOGGER . debug ( "Retrieving authentication request from scope" ) ; val requestValue = request . getParameter ( SamlProtocolConstants . PARAMETER_SAML_REQUEST ) ; if ( StringUtils . isBlank ( ...
Retrieve authn request authn request .
18,442
protected void logCasValidationAssertion ( final Assertion assertion ) { LOGGER . debug ( "CAS Assertion Valid: [{}]" , assertion . isValid ( ) ) ; LOGGER . debug ( "CAS Assertion Principal: [{}]" , assertion . getPrincipal ( ) . getName ( ) ) ; LOGGER . debug ( "CAS Assertion authentication Date: [{}]" , assertion . g...
Log cas validation assertion .
18,443
protected void issueAuthenticationRequestRedirect ( final Pair < ? extends SignableSAMLObject , MessageContext > pair , final HttpServletRequest request , final HttpServletResponse response ) throws Exception { val authnRequest = ( AuthnRequest ) pair . getLeft ( ) ; val serviceUrl = constructServiceUrl ( request , res...
Redirect request for authentication .
18,444
protected Map < String , String > getAuthenticationContextMappings ( ) { val authnContexts = samlProfileHandlerConfigurationContext . getCasProperties ( ) . getAuthn ( ) . getSamlIdp ( ) . getAuthenticationContextClassMappings ( ) ; return CollectionUtils . convertDirectedListToMap ( authnContexts ) ; }
Gets authentication context mappings .
18,445
protected String buildRedirectUrlByRequestedAuthnContext ( final String initialUrl , final AuthnRequest authnRequest , final HttpServletRequest request ) { val authenticationContextClassMappings = samlProfileHandlerConfigurationContext . getCasProperties ( ) . getAuthn ( ) . getSamlIdp ( ) . getAuthenticationContextCla...
Build redirect url by requested authn context .
18,446
protected void initiateAuthenticationRequest ( final Pair < ? extends SignableSAMLObject , MessageContext > pair , final HttpServletResponse response , final HttpServletRequest request ) throws Exception { verifySamlAuthenticationRequest ( pair , request ) ; issueAuthenticationRequestRedirect ( pair , request , respons...
Initiate authentication request .
18,447
protected Pair < SamlRegisteredService , SamlRegisteredServiceServiceProviderMetadataFacade > verifySamlAuthenticationRequest ( final Pair < ? extends SignableSAMLObject , MessageContext > authenticationContext , final HttpServletRequest request ) throws Exception { val authnRequest = ( AuthnRequest ) authenticationCon...
Verify saml authentication request .
18,448
protected void buildSamlResponse ( final HttpServletResponse response , final HttpServletRequest request , final Pair < AuthnRequest , MessageContext > authenticationContext , final Assertion casAssertion , final String binding ) { val authnRequest = authenticationContext . getKey ( ) ; val pair = getRegisteredServiceA...
Build saml response .
18,449
protected Pair < SamlRegisteredService , SamlRegisteredServiceServiceProviderMetadataFacade > getRegisteredServiceAndFacade ( final AuthnRequest request ) { val issuer = SamlIdPUtils . getIssuerFromSamlObject ( request ) ; LOGGER . debug ( "Located issuer [{}] from authentication context" , issuer ) ; val registeredSer...
Gets registered service and facade .
18,450
protected MessageContext decodeSoapRequest ( final HttpServletRequest request ) { try { val decoder = new HTTPSOAP11Decoder ( ) ; decoder . setParserPool ( samlProfileHandlerConfigurationContext . getOpenSamlConfigBean ( ) . getParserPool ( ) ) ; decoder . setHttpServletRequest ( request ) ; val binding = new BindingDe...
Decode soap 11 context .
18,451
private int deleteTicketGrantingTickets ( final String ticketId ) { var totalCount = 0 ; val st = this . ticketCatalog . find ( ServiceTicket . PREFIX ) ; val sql1 = String . format ( "delete from %s s where s.ticketGrantingTicket.id = :id" , getTicketEntityName ( st ) ) ; var query = entityManager . createQuery ( sql1...
Delete ticket granting tickets int .
18,452
@ GetMapping ( produces = MediaType . APPLICATION_JSON_VALUE ) public ResponseEntity ssoStatus ( final HttpServletRequest request ) { val tgtId = this . ticketGrantingTicketCookieGenerator . retrieveCookieValue ( request ) ; if ( StringUtils . isNotBlank ( tgtId ) ) { val auth = this . ticketRegistrySupport . getAuthen...
Sso status response entity .
18,453
public static Pair < Boolean , Optional < Map < String , Object > > > authenticate ( final String username , final String password , final List < RadiusServer > servers , final boolean failoverOnAuthenticationFailure , final boolean failoverOnException , final Optional state ) throws Exception { for ( val radiusServer ...
Authenticate pair .
18,454
@ ShellMethod ( key = "find" , value = "Look up properties associated with a CAS group/module." ) public void find ( @ ShellOption ( value = { "name" } , help = "Property name regex pattern" , defaultValue = ".+" ) final String name , @ ShellOption ( value = { "strict-match" } , help = "Whether pattern should be done i...
Find property .
18,455
public Map < String , ConfigurationMetadataProperty > findByProperty ( final String name ) { return find ( false , RegexUtils . createPattern ( name ) ) ; }
Find by group .
18,456
public static PrivateKey extractPrivateKeyFromResource ( final String signingSecretKey ) { LOGGER . debug ( "Attempting to extract private key..." ) ; val resource = ResourceUtils . getResourceFrom ( signingSecretKey ) ; val factory = new PrivateKeyFactoryBean ( ) ; factory . setAlgorithm ( RsaKeyUtil . RSA ) ; factory...
Extract private key from resource private key .
18,457
public static PublicKey extractPublicKeyFromResource ( final String secretKeyToUse ) { LOGGER . debug ( "Attempting to extract public key from [{}]..." , secretKeyToUse ) ; val resource = ResourceUtils . getResourceFrom ( secretKeyToUse ) ; val factory = new PublicKeyFactoryBean ( ) ; factory . setAlgorithm ( RsaKeyUti...
Extract public key from resource public key .
18,458
protected byte [ ] sign ( final byte [ ] value ) { if ( this . signingKey == null ) { return value ; } if ( "RSA" . equalsIgnoreCase ( this . signingKey . getAlgorithm ( ) ) ) { return EncodingUtils . signJwsRSASha512 ( this . signingKey , value ) ; } return EncodingUtils . signJwsHMACSha512 ( this . signingKey , value...
Sign the array by first turning it into a base64 encoded string .
18,459
protected void configureSigningKey ( final String signingSecretKey ) { try { if ( ResourceUtils . doesResourceExist ( signingSecretKey ) ) { configureSigningKeyFromPrivateKeyResource ( signingSecretKey ) ; } } finally { if ( this . signingKey == null ) { setSigningKey ( new AesKey ( signingSecretKey . getBytes ( Standa...
Sets signing key . If the key provided is resolved as a private key then will create use the private key as is and will sign values using RSA . Otherwise AES is used .
18,460
protected void configureSigningKeyFromPrivateKeyResource ( final String signingSecretKey ) { val object = extractPrivateKeyFromResource ( signingSecretKey ) ; LOGGER . trace ( "Located signing key resource [{}]" , signingSecretKey ) ; setSigningKey ( object ) ; }
Configure signing key from private key resource .
18,461
protected OAuth20TokenGeneratedResult generateAccessTokenOAuthDeviceCodeResponseType ( final AccessTokenRequestDataHolder holder ) { val deviceCode = holder . getDeviceCode ( ) ; if ( StringUtils . isNotBlank ( deviceCode ) ) { val deviceCodeTicket = getDeviceTokenFromTicketRegistry ( deviceCode ) ; val deviceUserCode ...
Generate access token OAuth device code response type OAuth token generated result .
18,462
protected Pair < AccessToken , RefreshToken > generateAccessTokenOAuthGrantTypes ( final AccessTokenRequestDataHolder holder ) { LOGGER . debug ( "Creating access token for [{}]" , holder . getService ( ) ) ; val clientId = holder . getRegisteredService ( ) . getClientId ( ) ; val authn = DefaultAuthenticationBuilder ....
Generate access token OAuth grant types pair .
18,463
protected void updateOAuthCode ( final AccessTokenRequestDataHolder holder ) { if ( holder . getToken ( ) instanceof OAuthCode ) { val codeState = TicketState . class . cast ( holder . getToken ( ) ) ; codeState . update ( ) ; if ( holder . getToken ( ) . isExpired ( ) ) { this . ticketRegistry . deleteTicket ( holder ...
Update OAuth code .
18,464
protected void addTicketToRegistry ( final Ticket ticket , final TicketGrantingTicket ticketGrantingTicket ) { LOGGER . debug ( "Adding ticket [{}] to registry" , ticket ) ; this . ticketRegistry . addTicket ( ticket ) ; if ( ticketGrantingTicket != null ) { LOGGER . debug ( "Updating parent ticket-granting ticket [{}]...
Add ticket to registry .
18,465
protected RefreshToken generateRefreshToken ( final AccessTokenRequestDataHolder responseHolder ) { LOGGER . debug ( "Creating refresh token for [{}]" , responseHolder . getService ( ) ) ; val refreshToken = this . refreshTokenFactory . create ( responseHolder . getService ( ) , responseHolder . getAuthentication ( ) ,...
Generate refresh token .
18,466
protected Event grantTicketGrantingTicketToAuthenticationResult ( final RequestContext context , final AuthenticationResultBuilder authenticationResultBuilder , final Service service ) { WebUtils . putAuthenticationResultBuilder ( authenticationResultBuilder , context ) ; WebUtils . putServiceIntoFlowScope ( context , ...
Grant ticket granting ticket .
18,467
protected void putResolvedEventsAsAttribute ( final RequestContext context , final Set < Event > resolvedEvents ) { context . getAttributes ( ) . put ( RESOLVED_AUTHENTICATION_EVENTS , resolvedEvents ) ; }
Put resolved events as attribute .
18,468
protected Service resolveServiceFromAuthenticationRequest ( final RequestContext context ) { val ctxService = WebUtils . getService ( context ) ; return resolveServiceFromAuthenticationRequest ( ctxService ) ; }
Resolve service from authentication request service .
18,469
protected Set < Event > getResolvedEventsAsAttribute ( final RequestContext context ) { return context . getAttributes ( ) . get ( RESOLVED_AUTHENTICATION_EVENTS , Set . class ) ; }
Gets resolved events as attribute .
18,470
protected Set < Event > handleAuthenticationTransactionAndGrantTicketGrantingTicket ( final RequestContext context ) { val response = WebUtils . getHttpServletResponseFromExternalWebflowContext ( context ) ; try { val credential = getCredentialFromContext ( context ) ; val builderResult = WebUtils . getAuthenticationRe...
Handle authentication transaction and grant ticket granting ticket .
18,471
protected Set < Event > handlePossibleSuspiciousAttempt ( final HttpServletRequest request , final Authentication authentication , final RegisteredService service ) { getWebflowEventResolutionConfigurationContext ( ) . getEventPublisher ( ) . publishEvent ( new CasRiskBasedAuthenticationEvaluationStartedEvent ( this , ...
Handle possible suspicious attempt .
18,472
protected Principal createPrincipal ( final String username , final LdapEntry ldapEntry ) throws LoginException { LOGGER . debug ( "Creating LDAP principal for [{}] based on [{}] and attributes [{}]" , username , ldapEntry . getDn ( ) , ldapEntry . getAttributeNames ( ) ) ; val id = getLdapPrincipalIdentifier ( usernam...
Creates a CAS principal with attributes if the LDAP entry contains principal attributes .
18,473
protected Map < String , List < Object > > collectAttributesForLdapEntry ( final LdapEntry ldapEntry , final String username ) { val attributeMap = Maps . < String , List < Object > > newHashMapWithExpectedSize ( this . principalAttributeMap . size ( ) ) ; LOGGER . debug ( "The following attributes are requested to be ...
Collect attributes for ldap entry .
18,474
protected String getLdapPrincipalIdentifier ( final String username , final LdapEntry ldapEntry ) throws LoginException { if ( StringUtils . isNotBlank ( this . principalIdAttribute ) ) { val principalAttr = ldapEntry . getAttribute ( this . principalIdAttribute ) ; if ( principalAttr == null || principalAttr . size ( ...
Gets ldap principal identifier . If the principal id attribute is defined it s retrieved . If no attribute value is found a warning is generated and the provided username is used instead . If no attribute is defined username is used instead .
18,475
public void initialize ( ) { val attributes = new HashSet < String > ( ) ; LOGGER . debug ( "Initializing LDAP attribute configuration..." ) ; if ( StringUtils . isNotBlank ( this . principalIdAttribute ) ) { LOGGER . debug ( "Configured to retrieve principal id attribute [{}]" , this . principalIdAttribute ) ; attribu...
Initialize the handler setup the authentication entry attributes .
18,476
protected List < String > resolveEventFromHttpRequest ( final HttpServletRequest request ) { val mfaRequestHeader = casProperties . getAuthn ( ) . getMfa ( ) . getRequestHeader ( ) ; val headers = request . getHeaders ( mfaRequestHeader ) ; if ( headers != null && headers . hasMoreElements ( ) ) { LOGGER . debug ( "Rec...
Resolve event from http request .
18,477
protected void doPublishEvent ( final ApplicationEvent e ) { if ( applicationEventPublisher != null ) { LOGGER . trace ( "Publishing [{}]" , e ) ; this . applicationEventPublisher . publishEvent ( e ) ; } }
Publish CAS events .
18,478
protected Authentication getAuthenticationSatisfiedByPolicy ( final Authentication authentication , final ServiceContext context ) throws AbstractTicketException { val policy = this . serviceContextAuthenticationPolicyFactory . createPolicy ( context ) ; try { if ( policy . isSatisfiedBy ( authentication ) ) { return a...
Gets the authentication satisfied by policy .
18,479
protected void evaluateProxiedServiceIfNeeded ( final Service service , final TicketGrantingTicket ticketGrantingTicket , final RegisteredService registeredService ) { val proxiedBy = ticketGrantingTicket . getProxiedBy ( ) ; if ( proxiedBy != null ) { LOGGER . debug ( "Ticket-granting ticket is proxied by [{}]. Locati...
Evaluate proxied service if needed .
18,480
protected void verifyTicketState ( final Ticket ticket , final String id , final Class clazz ) { if ( ticket == null ) { LOGGER . debug ( "Ticket [{}] by type [{}] cannot be found in the ticket registry." , id , clazz != null ? clazz . getSimpleName ( ) : "unspecified" ) ; throw new InvalidTicketException ( id ) ; } if...
Validate ticket expiration policy and throws exception if ticket is no longer valid . Expired tickets are also deleted from the registry immediately on demand .
18,481
protected boolean isTicketAuthenticityVerified ( final String ticketId ) { if ( this . cipherExecutor != null ) { LOGGER . trace ( "Attempting to decode service ticket [{}] to verify authenticity" , ticketId ) ; return ! StringUtils . isEmpty ( this . cipherExecutor . decode ( ticketId ) ) ; } return ! StringUtils . is...
Verify the ticket id received is actually legitimate before contacting downstream systems to find and process it .
18,482
public static String getDocumentLink ( final String databaseName , final String collectionName , final String documentId ) { return getCollectionLink ( databaseName , collectionName ) + "/docs/" + documentId ; }
Gets document link .
18,483
public DocumentClient createDocumentClient ( final BaseCosmosDbProperties properties ) { val policy = ConnectionPolicy . GetDefault ( ) ; var userAgent = ( policy . getUserAgentSuffix ( ) == null ? StringUtils . EMPTY : ';' + policy . getUserAgentSuffix ( ) ) + ';' + USER_AGENT_SUFFIX ; if ( properties . isAllowTelemet...
Create document client .
18,484
public DocumentDbFactory createDocumentDbFactory ( final BaseCosmosDbProperties properties ) { val documentClient = createDocumentClient ( properties ) ; return new DocumentDbFactory ( documentClient ) ; }
Create document db factory .
18,485
public DocumentDbTemplate createDocumentDbTemplate ( final DocumentDbFactory documentDbFactory , final BaseCosmosDbProperties properties ) { val documentDbMappingContext = createDocumentDbMappingContext ( ) ; val mappingDocumentDbConverter = createMappingDocumentDbConverter ( documentDbMappingContext ) ; return new Doc...
Create document db template document db template .
18,486
public DocumentDbMappingContext createDocumentDbMappingContext ( ) { val documentDbMappingContext = new DocumentDbMappingContext ( ) ; documentDbMappingContext . setInitialEntitySet ( new EntityScanner ( applicationContext ) . scan ( Persistent . class ) ) ; return documentDbMappingContext ; }
Create document db mapping context .
18,487
private static String findCurrentClientName ( final J2EContext webContext ) { val pm = new ProfileManager < > ( webContext , webContext . getSessionStore ( ) ) ; val profile = pm . get ( true ) ; return profile . map ( CommonProfile :: getClientName ) . orElse ( null ) ; }
Finds the current client name from the context using the PAC4J Profile Manager . It is assumed that the context has previously been populated with the profile .
18,488
protected void finalizeSamlResponse ( final HttpServletRequest request , final HttpServletResponse response , final String serviceId , final Response samlResponse ) throws Exception { if ( request != null && response != null ) { LOGGER . debug ( "Starting to encode SAML response for service [{}]" , serviceId ) ; this ....
Finalize saml response .
18,489
public static JoinPoint unWrapJoinPoint ( final JoinPoint point ) { var naked = point ; while ( naked . getArgs ( ) != null && naked . getArgs ( ) . length > 0 && naked . getArgs ( ) [ 0 ] instanceof JoinPoint ) { naked = ( JoinPoint ) naked . getArgs ( ) [ 0 ] ; } return naked ; }
Unwraps a join point that may be nested due to layered proxies .
18,490
protected void doHealthCheck ( final Health . Builder builder ) { val samlServices = servicesManager . findServiceBy ( registeredService -> registeredService instanceof SamlRegisteredService ) ; val availableResolvers = this . metadataResolutionPlan . getRegisteredMetadataResolvers ( ) ; LOGGER . debug ( "There are [{}...
Check for availability of metadata sources . Only need 1 valid resolver for metadata to be available .
18,491
protected void addProfileRoles ( final LdapEntry userEntry , final CommonProfile profile , final LdapAttribute attribute , final String prefix ) { addProfileRolesFromAttributes ( profile , attribute , prefix ) ; }
Add profile roles .
18,492
protected void addProfileRolesFromAttributes ( final CommonProfile profile , final LdapAttribute ldapAttribute , final String prefix ) { ldapAttribute . getStringValues ( ) . forEach ( value -> profile . addRole ( prefix . concat ( value . toUpperCase ( ) ) ) ) ; }
Add profile roles from attributes .
18,493
protected String signToken ( final OidcRegisteredService svc , final JsonWebSignature jws ) throws Exception { LOGGER . debug ( "Fetching JSON web key to sign the token for : [{}]" , svc . getClientId ( ) ) ; val jsonWebKey = getJsonWebKeySigningKey ( ) ; LOGGER . debug ( "Found JSON web key to sign the token: [{}]" , ...
Sign token .
18,494
protected JsonWebKey getJsonWebKeyForEncryption ( final OidcRegisteredService svc ) { LOGGER . debug ( "Service [{}] is set to encrypt tokens" , svc ) ; val jwks = this . serviceJsonWebKeystoreCache . get ( svc ) ; if ( Objects . requireNonNull ( jwks ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Service " ...
Gets json web key for encryption .
18,495
public ObjectPool < MemcachedClientIF > getObjectPool ( ) { val pool = new GenericObjectPool < MemcachedClientIF > ( this ) ; pool . setMaxIdle ( memcachedProperties . getMaxIdle ( ) ) ; pool . setMinIdle ( memcachedProperties . getMinIdle ( ) ) ; pool . setMaxTotal ( memcachedProperties . getMaxTotal ( ) ) ; return po...
Gets object pool .
18,496
public void initialize ( ) { val pair = buildLoggerContext ( environment , resourceLoader ) ; pair . ifPresent ( it -> { this . logConfigurationFile = it . getKey ( ) ; this . loggerContext = it . getValue ( ) ; } ) ; }
Init . Attempts to locate the logging configuration to insert listeners . The log configuration location is pulled directly from the environment given there is not an explicit property mapping for it provided by Boot etc .
18,497
private Set < LoggerConfig > getLoggerConfigurations ( ) { val configuration = this . loggerContext . getConfiguration ( ) ; return new HashSet < > ( configuration . getLoggers ( ) . values ( ) ) ; }
Gets logger configurations .
18,498
public void updateLoggerLevel ( final String loggerName , final String loggerLevel , final boolean additive ) { val loggerConfigs = getLoggerConfigurations ( ) ; loggerConfigs . stream ( ) . filter ( cfg -> cfg . getName ( ) . equals ( loggerName ) ) . forEachOrdered ( cfg -> { cfg . setLevel ( Level . getLevel ( logge...
Looks up the logger in the logger factory and attempts to find the real logger instance based on the underlying logging framework and retrieve the logger object . Then updates the level . This functionality at this point is heavily dependant on the log4j API .
18,499
@ View ( name = "by_name" , map = "function(doc) { if(doc.name && doc.value) { emit(doc.name, doc) } }" ) public CouchDbSamlMetadataDocument findFirstByName ( final String name ) { val view = createQuery ( "by_name" ) . key ( name ) . limit ( 1 ) ; return db . queryView ( view , CouchDbSamlMetadataDocument . class ) . ...
Find by name .