idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
18,100
protected OAuthRegisteredService getOAuthRegisteredServiceBy ( final HttpServletRequest request ) { val redirectUri = getRegisteredServiceIdentifierFromRequest ( request ) ; val registeredService = OAuth20Utils . getRegisteredOAuthServiceByRedirectUri ( getOAuthConfigurationContext ( ) . getServicesManager ( ) , redire...
Gets oauth registered service from the request . Implementation attempts to locate the redirect uri from request and check with service registry to find a matching oauth service .
18,101
public static String buildTypeSourcePath ( final String sourcePath , final String type ) { val newName = type . replace ( "." , File . separator ) ; return sourcePath + "/src/main/java/" + newName + ".java" ; }
Build type source path string .
18,102
public Class locatePropertiesClassForType ( final ClassOrInterfaceType type ) { if ( cachedPropertiesClasses . containsKey ( type . getNameAsString ( ) ) ) { return cachedPropertiesClasses . get ( type . getNameAsString ( ) ) ; } val packageName = ConfigurationMetadataGenerator . class . getPackage ( ) . getName ( ) ; ...
Locate properties class for type class .
18,103
public BaseConfigurationPropertiesLoader getLoader ( final Resource resource , final String name ) { val filename = StringUtils . defaultString ( resource . getFilename ( ) ) . toLowerCase ( ) ; if ( filename . endsWith ( ".properties" ) ) { return new SimpleConfigurationPropertiesLoader ( this . configurationCipherExe...
Gets loader .
18,104
public static List < String > getApplicationProfiles ( final Environment environment ) { return Arrays . stream ( environment . getActiveProfiles ( ) ) . collect ( Collectors . toList ( ) ) ; }
Gets application profiles .
18,105
public Collection < Ticket > getTokens ( ) { return ticketRegistry . getTickets ( ticket -> ( ticket instanceof AccessToken || ticket instanceof RefreshToken ) && ! ticket . isExpired ( ) ) . sorted ( Comparator . comparing ( Ticket :: getId ) ) . collect ( Collectors . toList ( ) ) ; }
Gets access tokens .
18,106
public Ticket getToken ( final String ticketId ) { var ticket = ( Ticket ) ticketRegistry . getTicket ( ticketId , AccessToken . class ) ; if ( ticket == null ) { ticket = ticketRegistry . getTicket ( ticketId , RefreshToken . class ) ; } if ( ticket == null ) { LOGGER . debug ( "Ticket [{}] is not found" , ticketId ) ...
Gets access token .
18,107
public void deleteToken ( final String ticketId ) { val ticket = getToken ( ticketId ) ; if ( ticket != null ) { ticketRegistry . deleteTicket ( ticketId ) ; } }
Delete access token .
18,108
public OneTimeTokenAccount create ( final String username ) { val key = getGoogleAuthenticator ( ) . createCredentials ( ) ; return new GoogleAuthenticatorAccount ( username , key . getKey ( ) , key . getVerificationCode ( ) , key . getScratchCodes ( ) ) ; }
Create one time token account .
18,109
protected ProcessedClaim createProcessedClaim ( final Claim requestClaim , final ClaimsParameters parameters ) { val claim = new ProcessedClaim ( ) ; claim . setClaimType ( createProcessedClaimType ( requestClaim , parameters ) ) ; claim . setIssuer ( this . issuer ) ; claim . setOriginalIssuer ( this . issuer ) ; clai...
Create processed claim processed claim .
18,110
@ PostMapping ( value = "/v1/services" , consumes = MediaType . APPLICATION_JSON_VALUE ) public ResponseEntity < String > createService ( final RegisteredService service , final HttpServletRequest request , final HttpServletResponse response ) { try { val auth = authenticateRequest ( request , response ) ; if ( isAuthe...
Create new service .
18,111
public String determinePrincipalIdFromAttributes ( final String defaultId , final Map < String , List < Object > > attributes ) { return FunctionUtils . doIf ( StringUtils . isNotBlank ( this . attribute ) && attributes . containsKey ( this . attribute ) , ( ) -> { val attributeValue = attributes . get ( this . attribu...
Determine principal id from attributes .
18,112
protected String digestAndEncodeWithSalt ( final MessageDigest md ) { val sanitizedSalt = StringUtils . replace ( salt , "\n" , " " ) ; val digested = md . digest ( sanitizedSalt . getBytes ( StandardCharsets . UTF_8 ) ) ; return EncodingUtils . encodeBase64 ( digested , false ) ; }
Digest and encode with salt string .
18,113
protected static MessageDigest prepareMessageDigest ( final String principal , final String service ) throws NoSuchAlgorithmException { val md = MessageDigest . getInstance ( "SHA" ) ; if ( StringUtils . isNotBlank ( service ) ) { md . update ( service . getBytes ( StandardCharsets . UTF_8 ) ) ; md . update ( CONST_SEP...
Prepare message digest message digest .
18,114
public void write ( final Point point ) { this . influxDb . write ( influxDbProperties . getDatabase ( ) , influxDbProperties . getRetentionPolicy ( ) , point ) ; }
Write measurement point .
18,115
public void writeBatch ( final Point ... point ) { val batchPoints = BatchPoints . database ( influxDbProperties . getDatabase ( ) ) . retentionPolicy ( influxDbProperties . getRetentionPolicy ( ) ) . consistency ( InfluxDB . ConsistencyLevel . valueOf ( influxDbProperties . getConsistencyLevel ( ) ) ) . build ( ) ; Ar...
Write synchronized batch .
18,116
protected Map < String , Object > findAccountViaRestApi ( final Map < String , Object > headers ) { HttpResponse response = null ; try { response = HttpUtils . execute ( properties . getUrl ( ) , properties . getMethod ( ) , properties . getBasicAuthUsername ( ) , properties . getBasicAuthPassword ( ) , new HashMap < >...
Find account via rest api and return user - info map .
18,117
public static < K , V > RedisTemplate < K , V > newRedisTemplate ( final RedisConnectionFactory connectionFactory ) { val template = new RedisTemplate < K , V > ( ) ; val string = new StringRedisSerializer ( ) ; val jdk = new JdkSerializationRedisSerializer ( ) ; template . setKeySerializer ( string ) ; template . setV...
New redis template .
18,118
public static RedisConnectionFactory newRedisConnectionFactory ( final BaseRedisProperties redis ) { val redisConfiguration = redis . getSentinel ( ) == null ? ( RedisConfiguration ) getStandaloneConfig ( redis ) : getSentinelConfig ( redis ) ; val factory = new LettuceConnectionFactory ( redisConfiguration , getRedisP...
New redis connection factory .
18,119
@ SuppressFBWarnings ( "PRMC_POSSIBLY_REDUNDANT_METHOD_CALLS" ) public void initServiceRegistryIfNecessary ( ) { val size = this . serviceRegistry . size ( ) ; LOGGER . trace ( "Service registry contains [{}] service definition(s)" , size ) ; LOGGER . warn ( "Service registry [{}] will be auto-initialized from JSON ser...
Init service registry if necessary .
18,120
public void execute ( ) { OrderComparator . sortIfNecessary ( webflowConfigurers ) ; webflowConfigurers . forEach ( c -> { LOGGER . trace ( "Registering webflow configurer [{}]" , c . getName ( ) ) ; c . initialize ( ) ; } ) ; }
Execute the plan .
18,121
private static AbstractWebApplicationService determineWebApplicationFormat ( final HttpServletRequest request , final AbstractWebApplicationService webApplicationService ) { val format = request != null ? request . getParameter ( CasProtocolConstants . PARAMETER_FORMAT ) : null ; try { if ( StringUtils . isNotBlank ( f...
Determine web application format boolean .
18,122
protected static AbstractWebApplicationService newWebApplicationService ( final HttpServletRequest request , final String serviceToUse ) { val artifactId = request != null ? request . getParameter ( CasProtocolConstants . PARAMETER_TICKET ) : null ; val id = cleanupUrl ( serviceToUse ) ; val newService = new SimpleWebA...
Build new web application service simple web application service .
18,123
protected String getRequestedService ( final HttpServletRequest request ) { val targetService = request . getParameter ( CasProtocolConstants . PARAMETER_TARGET_SERVICE ) ; val service = request . getParameter ( CasProtocolConstants . PARAMETER_SERVICE ) ; val serviceAttribute = request . getAttribute ( CasProtocolCons...
Gets requested service .
18,124
public TransientSessionTicket create ( final Service service , final Map < String , Serializable > properties ) { val id = ticketIdGenerator . getNewTicketId ( "CAS" ) ; return new TransientSessionTicketImpl ( id , expirationPolicy , service , properties ) ; }
Create delegated authentication request ticket .
18,125
protected static boolean locateMatchingAttributeBasedOnAuthenticationAttributes ( final MultifactorAuthenticationProviderBypassProperties bypass , final Authentication authn ) { return locateMatchingAttributeValue ( bypass . getAuthenticationAttributeName ( ) , bypass . getAuthenticationAttributeValue ( ) , authn . get...
Skip bypass and support event based on authentication attributes .
18,126
public void postLoad ( ) { if ( principalAttributesRepository == null ) { this . principalAttributesRepository = new DefaultPrincipalAttributesRepository ( ) ; } if ( consentPolicy == null ) { this . consentPolicy = new DefaultRegisteredServiceConsentPolicy ( ) ; } }
Post load after having loaded the bean via JPA etc .
18,127
protected Map < String , List < Object > > resolveAttributesFromPrincipalAttributeRepository ( final Principal principal , final RegisteredService registeredService ) { val repository = ObjectUtils . defaultIfNull ( this . principalAttributesRepository , getPrincipalAttributesRepositoryFromApplicationContext ( ) ) ; if...
Resolve attributes from principal attribute repository .
18,128
protected void insertPrincipalIdAsAttributeIfNeeded ( final Principal principal , final Map < String , List < Object > > attributesToRelease , final Service service , final RegisteredService registeredService ) { if ( StringUtils . isNotBlank ( getPrincipalIdAttribute ( ) ) ) { LOGGER . debug ( "Attempting to resolve t...
Release principal id as attribute if needed .
18,129
protected Map < String , List < Object > > returnFinalAttributesCollection ( final Map < String , List < Object > > attributesToRelease , final RegisteredService service ) { LOGGER . debug ( "Final collection of attributes allowed are: [{}]" , attributesToRelease ) ; return attributesToRelease ; }
Return the final attributes collection . Subclasses may override this minute to impose last minute rules .
18,130
protected Map < String , List < Object > > getReleasedByDefaultAttributes ( final Principal p , final Map < String , List < Object > > attributes ) { val ctx = ApplicationContextProvider . getApplicationContext ( ) ; if ( ctx != null ) { LOGGER . trace ( "Located application context. Retrieving default attributes for r...
Determines a default bundle of attributes that may be released to all services without the explicit mapping for each service .
18,131
public < T > T build ( final AwsClientBuilder builder , final Class < T > clientType ) { val cfg = new ClientConfiguration ( ) ; try { val localAddress = getSetting ( "localAddress" ) ; if ( StringUtils . isNotBlank ( localAddress ) ) { cfg . setLocalAddress ( InetAddress . getByName ( localAddress ) ) ; } } catch ( fi...
Build the client .
18,132
private static double submissionRate ( final ZonedDateTime a , final ZonedDateTime b ) { return SUBMISSION_RATE_DIVIDEND / ( a . toInstant ( ) . toEpochMilli ( ) - b . toInstant ( ) . toEpochMilli ( ) ) ; }
Computes the instantaneous rate in between two given dates corresponding to two submissions .
18,133
public void decrement ( ) { LOGGER . info ( "Beginning audit cleanup..." ) ; val now = ZonedDateTime . now ( ZoneOffset . UTC ) ; this . ipMap . entrySet ( ) . removeIf ( entry -> submissionRate ( now , entry . getValue ( ) ) < getThresholdRate ( ) ) ; LOGGER . debug ( "Done decrementing count for throttler." ) ; }
This class relies on an external configuration to clean it up . It ignores the threshold data in the parent class .
18,134
private static Reason getReasonFromX509Entry ( final X509CRLEntry entry ) { if ( entry . hasExtensions ( ) ) { try { val code = Integer . parseInt ( new String ( entry . getExtensionValue ( CRL_REASON_OID ) , "ASCII" ) ) ; if ( code < Reason . values ( ) . length ) { return Reason . fromCode ( code ) ; } } catch ( fina...
Get reason from the x509 entry .
18,135
public static HibernateJpaVendorAdapter newHibernateJpaVendorAdapter ( final DatabaseProperties databaseProperties ) { val bean = new HibernateJpaVendorAdapter ( ) ; bean . setGenerateDdl ( databaseProperties . isGenDdl ( ) ) ; bean . setShowSql ( databaseProperties . isShowSql ( ) ) ; return bean ; }
New hibernate jpa vendor adapter .
18,136
public static LocalContainerEntityManagerFactoryBean newHibernateEntityManagerFactoryBean ( final JpaConfigDataHolder config , final AbstractJpaProperties jpaProperties ) { val bean = new LocalContainerEntityManagerFactoryBean ( ) ; bean . setJpaVendorAdapter ( config . getJpaVendorAdapter ( ) ) ; if ( StringUtils . is...
New entity manager factory bean .
18,137
public Response createResponse ( final String serviceId , final WebApplicationService service ) { return this . samlObjectBuilder . newResponse ( this . samlObjectBuilder . generateSecureRandomId ( ) , ZonedDateTime . now ( ZoneOffset . UTC ) . minusSeconds ( this . skewAllowance ) , serviceId , service ) ; }
Create response .
18,138
public void setStatusRequestDenied ( final Response response , final String description ) { response . setStatus ( this . samlObjectBuilder . newStatus ( StatusCode . REQUEST_DENIED , description ) ) ; }
Sets status request denied .
18,139
public void prepareSuccessfulResponse ( final Response response , final Service service , final Authentication authentication , final Principal principal , final Map < String , List < Object > > authnAttributes , final Map < String , List < Object > > principalAttributes ) { val issuedAt = DateTimeUtils . zonedDateTime...
Prepare successful response .
18,140
public void encodeSamlResponse ( final Response samlResponse , final HttpServletRequest request , final HttpServletResponse response ) throws Exception { this . samlObjectBuilder . encodeSamlResponse ( response , request , samlResponse ) ; }
Encode saml response .
18,141
@ ShellMethod ( key = "generate-idp-metadata" , value = "Generate SAML2 IdP Metadata" ) public void generate ( @ ShellOption ( value = { "metadataLocation" } , help = "Directory location to hold metadata and relevant keys/certificates" , defaultValue = "/etc/cas/saml" ) final String metadataLocation , @ ShellOption ( v...
Generate saml2 idp metadata at the specified location .
18,142
public boolean email ( final Principal principal , final String attribute , final EmailProperties emailProperties , final String body ) { if ( StringUtils . isNotBlank ( attribute ) && principal . getAttributes ( ) . containsKey ( attribute ) && isMailSenderDefined ( ) ) { val to = getFirstAttributeByName ( principal ,...
Email boolean .
18,143
protected Principal getPrincipal ( final String name , final boolean isNtlm ) { if ( this . principalWithDomainName ) { return this . principalFactory . createPrincipal ( name ) ; } if ( isNtlm ) { if ( Pattern . matches ( "\\S+\\\\\\S+" , name ) ) { val splitList = Splitter . on ( Pattern . compile ( "\\\\" ) ) . spli...
Gets the principal from the given name . The principal is created by the factory instance .
18,144
public JwtTicketCipherExecutor getTokenTicketCipherExecutorForService ( final RegisteredService registeredService ) { val encryptionKey = getEncryptionKey ( registeredService ) . orElse ( StringUtils . EMPTY ) ; val signingKey = getSigningKey ( registeredService ) . orElse ( StringUtils . EMPTY ) ; return new JwtTicket...
Gets token ticket cipher executor for service .
18,145
public Optional < String > getSigningKey ( final RegisteredService registeredService ) { val property = getSigningKeyRegisteredServiceProperty ( ) ; if ( property . isAssignedTo ( registeredService ) ) { val signingKey = property . getPropertyValue ( registeredService ) . getValue ( ) ; return Optional . of ( signingKe...
Gets signing key .
18,146
public Optional < String > getEncryptionKey ( final RegisteredService registeredService ) { val property = getEncryptionKeyRegisteredServiceProperty ( ) ; if ( property . isAssignedTo ( registeredService ) ) { val key = property . getPropertyValue ( registeredService ) . getValue ( ) ; return Optional . of ( key ) ; } ...
Gets encryption key .
18,147
protected String encodeAndFinalizeToken ( final JwtClaims claims , final OAuthRegisteredService registeredService , final AccessToken accessToken ) { LOGGER . debug ( "Received claims for the id token [{}] as [{}]" , accessToken , claims ) ; val idTokenResult = getConfigurationContext ( ) . getIdTokenSigningAndEncrypti...
Encode and finalize token .
18,148
public Map < String , Object > releasePrincipalAttributes ( final String username , final String password , final String service ) { val selectedService = this . serviceFactory . createService ( service ) ; val registeredService = this . servicesManager . findServiceBy ( selectedService ) ; val credential = new Usernam...
Release principal attributes map .
18,149
private void setResponseHeader ( final RequestContext context ) { val credential = WebUtils . getCredential ( context ) ; if ( credential == null ) { LOGGER . debug ( "No credential was provided. No response header set." ) ; return ; } val response = WebUtils . getHttpServletResponseFromExternalWebflowContext ( context...
Sets the response header based on the retrieved token .
18,150
protected String encryptResolvedUsername ( final Principal principal , final Service service , final RegisteredService registeredService , final String username ) { val applicationContext = ApplicationContextProvider . getApplicationContext ( ) ; val cipher = applicationContext . getBean ( "registeredServiceCipherExecu...
Encrypt resolved username .
18,151
public List < ConfigurationMetadataSearchResult > search ( final String name ) { val allProps = repository . getRepository ( ) . getAllProperties ( ) ; if ( StringUtils . isNotBlank ( name ) && RegexUtils . isValidRegex ( name ) ) { val names = StreamSupport . stream ( RelaxedPropertyNames . forCamelCase ( name ) . spl...
Search for property .
18,152
private static void setInResponseToForSamlResponseIfNeeded ( final Service service , final Response samlResponse ) { if ( service instanceof SamlService ) { val samlService = ( SamlService ) service ; val requestId = samlService . getRequestId ( ) ; if ( StringUtils . isNotBlank ( requestId ) ) { samlResponse . setInRe...
Sets in response to for saml 1 response .
18,153
public AuthenticationStatement newAuthenticationStatement ( final ZonedDateTime authenticationDate , final Collection < Object > authenticationMethod , final String subjectId ) { val authnStatement = newSamlObject ( AuthenticationStatement . class ) ; authnStatement . setAuthenticationInstant ( DateTimeUtils . dateTime...
New authentication statement .
18,154
public Subject newSubject ( final String identifier , final String confirmationMethod ) { val confirmation = newSamlObject ( SubjectConfirmation . class ) ; val method = newSamlObject ( ConfirmationMethod . class ) ; method . setConfirmationMethod ( confirmationMethod ) ; confirmation . getConfirmationMethods ( ) . add...
New subject element with given confirmation method .
18,155
public void addAttributeValuesToSaml1Attribute ( final String attributeName , final Object attributeValue , final List < XMLObject > attributeList ) { addAttributeValuesToSamlAttribute ( attributeName , attributeValue , StringUtils . EMPTY , attributeList , AttributeValue . DEFAULT_ELEMENT_NAME ) ; }
Add saml1 attribute values for attribute .
18,156
public static Response getPostResponse ( final String url , final Map < String , String > attributes ) { return new DefaultResponse ( ResponseType . POST , url , attributes ) ; }
Gets the post response .
18,157
public static Response getHeaderResponse ( final String url , final Map < String , String > attributes ) { return new DefaultResponse ( ResponseType . HEADER , url , attributes ) ; }
Gets header response .
18,158
public static Response getRedirectResponse ( final String url , final Map < String , String > parameters ) { val builder = new StringBuilder ( parameters . size ( ) * RESPONSE_INITIAL_CAPACITY ) ; val sanitizedUrl = sanitizeUrl ( url ) ; LOGGER . debug ( "Sanitized URL for redirect response is [{}]" , sanitizedUrl ) ; ...
Gets the redirect response .
18,159
private static String sanitizeUrl ( final String url ) { val m = NON_PRINTABLE . matcher ( url ) ; val sb = new StringBuffer ( url . length ( ) ) ; var hasNonPrintable = false ; while ( m . find ( ) ) { m . appendReplacement ( sb , " " ) ; hasNonPrintable = true ; } m . appendTail ( sb ) ; if ( hasNonPrintable ) { LOGG...
Sanitize a URL provided by a relying party by normalizing non - printable ASCII character sequences into spaces . This functionality protects against CRLF attacks and other similar attacks using invisible characters that could be abused to trick user agents .
18,160
@ GetMapping ( path = SamlIdPConstants . ENDPOINT_IDP_METADATA ) public void generateMetadataForIdp ( final HttpServletResponse response ) throws IOException { this . metadataAndCertificatesGenerationService . generate ( ) ; val md = this . samlIdPMetadataLocator . getMetadata ( ) . getInputStream ( ) ; val contents = ...
Displays the identity provider metadata . Checks to make sure metadata exists and if not generates it first .
18,161
public ConfigurationMetadataProperty createConfigurationProperty ( final FieldDeclaration fieldDecl , final String propName ) { val variable = fieldDecl . getVariables ( ) . get ( 0 ) ; val name = StreamSupport . stream ( RelaxedPropertyNames . forCamelCase ( variable . getNameAsString ( ) ) . spliterator ( ) , false )...
Create configuration property .
18,162
@ ReadOperation ( produces = MediaType . TEXT_PLAIN_VALUE ) public String fetchPublicKey ( final String service ) throws Exception { val factory = KeyFactory . getInstance ( "RSA" ) ; var signingKey = tokenCipherExecutor . getSigningKey ( ) ; if ( StringUtils . isNotBlank ( service ) ) { val registeredService = this . ...
Fetch public key .
18,163
public Map < String , Object > getCachedMetadataObject ( final String serviceId , final String entityId ) { try { val registeredService = findRegisteredService ( serviceId ) ; val issuer = StringUtils . defaultIfBlank ( entityId , registeredService . getServiceId ( ) ) ; val criteriaSet = new CriteriaSet ( ) ; criteria...
Gets cached metadata object .
18,164
public static Resource prepareClasspathResourceIfNeeded ( final Resource resource ) { if ( resource == null ) { LOGGER . debug ( "No resource defined to prepare. Returning null" ) ; return null ; } return prepareClasspathResourceIfNeeded ( resource , false , resource . getFilename ( ) ) ; }
Prepare classpath resource if needed file .
18,165
public static Resource prepareClasspathResourceIfNeeded ( final Resource resource , final boolean isDirectory , final String containsName ) { LOGGER . trace ( "Preparing possible classpath resource [{}]" , resource ) ; if ( resource == null ) { LOGGER . debug ( "No resource defined to prepare. Returning null" ) ; retur...
If the provided resource is a classpath resource running inside an embedded container and if the container is running in a non - exploded form classpath resources become non - accessible . So this method will attempt to move resources out of classpath and onto a physical location outside the context typically in the ca...
18,166
public static InputStreamResource buildInputStreamResourceFrom ( final String value , final String description ) { val reader = new StringReader ( value ) ; val is = new ReaderInputStream ( reader , StandardCharsets . UTF_8 ) ; return new InputStreamResource ( is , description ) ; }
Build input stream resource from string value .
18,167
public Set < AuditActionContext > getAuditLog ( ) { val sinceDate = LocalDate . now ( ) . minusDays ( casProperties . getAudit ( ) . getNumberOfDaysInHistory ( ) ) ; return this . auditTrailManager . getAuditRecordsSince ( sinceDate ) ; }
Gets audit log .
18,168
public boolean isValid ( final String expectedAudience , final String expectedIssuer , final long timeDrift ) { if ( ! this . audience . equalsIgnoreCase ( expectedAudience ) ) { LOGGER . warn ( "Audience [{}] is invalid where the expected audience should be [{}]" , this . audience , expectedAudience ) ; return false ;...
isValid validates the credential .
18,169
private Event verify ( final RequestContext context , final Credential credential , final MessageContext messageContext ) { val res = repository . verify ( context , credential ) ; WebUtils . putPrincipal ( context , res . getPrincipal ( ) ) ; WebUtils . putAcceptableUsagePolicyStatusIntoFlowScope ( context , res ) ; v...
Verify whether the policy is accepted .
18,170
protected void validateIdTokenIfAny ( final AccessToken accessToken , final CommonProfile profile ) throws MalformedClaimException { if ( StringUtils . isNotBlank ( accessToken . getIdToken ( ) ) ) { val idTokenResult = idTokenSigningAndEncryptionService . validate ( accessToken . getIdToken ( ) ) ; profile . setId ( i...
Validate id token if any .
18,171
public static List < String > canonicalizeSecurityQuestions ( final Map < String , String > questionMap ) { val keys = new ArrayList < String > ( questionMap . keySet ( ) ) ; keys . sort ( String . CASE_INSENSITIVE_ORDER ) ; return keys ; }
Orders security questions consistently .
18,172
public MapConfig buildMapConfig ( final BaseHazelcastProperties hz , final String mapName , final long timeoutSeconds ) { val cluster = hz . getCluster ( ) ; val evictionPolicy = EvictionPolicy . valueOf ( cluster . getEvictionPolicy ( ) ) ; LOGGER . trace ( "Creating Hazelcast map configuration for [{}] with idle time...
Build map config map config .
18,173
protected static Pair < AuthnRequest , MessageContext > buildAuthenticationContextPair ( final HttpServletRequest request , final AuthnRequest authnRequest ) { val messageContext = bindRelayStateParameter ( request ) ; return Pair . of ( authnRequest , messageContext ) ; }
Build authentication context pair pair .
18,174
@ GetMapping ( path = SamlIdPConstants . ENDPOINT_SAML2_SSO_PROFILE_POST_CALLBACK ) protected void handleCallbackProfileRequest ( final HttpServletResponse response , final HttpServletRequest request ) throws Exception { LOGGER . info ( "Received SAML callback profile request [{}]" , request . getRequestURI ( ) ) ; val...
Handle callback profile request .
18,175
protected String determineProfileBinding ( final Pair < AuthnRequest , MessageContext > authenticationContext , final Assertion assertion ) { val authnRequest = authenticationContext . getKey ( ) ; val pair = getRegisteredServiceAndFacade ( authnRequest ) ; val facade = pair . getValue ( ) ; val binding = StringUtils ....
Determine profile binding .
18,176
protected BigDecimal calculateScore ( final HttpServletRequest request , final Authentication authentication , final RegisteredService service , final Collection < ? extends CasEvent > events ) { return HIGHEST_RISK_SCORE ; }
Calculate score authentication risk score .
18,177
protected Collection < ? extends CasEvent > getCasTicketGrantingTicketCreatedEventsFor ( final String principal ) { val type = CasTicketGrantingTicketCreatedEvent . class . getName ( ) ; LOGGER . debug ( "Retrieving events of type [{}] for [{}]" , type , principal ) ; val date = ZonedDateTime . now ( ZoneOffset . UTC )...
Gets cas ticket granting ticket created events .
18,178
protected BigDecimal calculateScoreBasedOnEventsCount ( final Authentication authentication , final Collection < ? extends CasEvent > events , final long count ) { if ( count == events . size ( ) ) { LOGGER . debug ( "Principal [{}] is assigned to the lowest risk score with attempted count of [{}]" , authentication . g...
Calculate score based on events count big decimal .
18,179
protected BigDecimal getFinalAveragedScore ( final long eventCount , final long total ) { val score = BigDecimal . valueOf ( eventCount ) . divide ( BigDecimal . valueOf ( total ) , 2 , RoundingMode . HALF_UP ) ; return HIGHEST_RISK_SCORE . subtract ( score ) ; }
Gets final averaged score .
18,180
public static boolean isExpired ( final X509CRL crl , final ZonedDateTime reference ) { return reference . isAfter ( DateTimeUtils . zonedDateTimeOf ( crl . getNextUpdate ( ) ) ) ; }
Determines whether the given CRL is expired by comparing the nextUpdate field with a given date .
18,181
public static X509Certificate readCertificate ( final InputStreamSource resource ) { try ( val in = resource . getInputStream ( ) ) { return CertUtil . readCertificate ( in ) ; } catch ( final IOException e ) { throw new IllegalArgumentException ( "Error reading certificate " + resource , e ) ; } }
Read certificate .
18,182
protected void buildEcpFaultResponse ( final HttpServletResponse response , final HttpServletRequest request , final Pair < RequestAbstractType , String > authenticationContext ) { request . setAttribute ( SamlIdPConstants . REQUEST_ATTRIBUTE_ERROR , authenticationContext . getValue ( ) ) ; getSamlProfileHandlerConfigu...
Build ecp fault response .
18,183
protected Authentication authenticateEcpRequest ( final Credential credential , final Pair < AuthnRequest , MessageContext > authnRequest ) { val issuer = SamlIdPUtils . getIssuerFromSamlObject ( authnRequest . getKey ( ) ) ; LOGGER . debug ( "Located issuer [{}] from request prior to authenticating [{}]" , issuer , cr...
Authenticate ecp request .
18,184
public Collection < Map < String , Object > > consentDecisions ( final String principal ) { val result = new HashSet < Map < String , Object > > ( ) ; LOGGER . debug ( "Fetching consent decisions for principal [{}]" , principal ) ; val consentDecisions = this . consentRepository . findConsentDecisions ( principal ) ; L...
Consent decisions collection .
18,185
public boolean revokeConsents ( final String principal , final long decisionId ) { LOGGER . debug ( "Deleting consent decisions for principal [{}]." , principal ) ; return this . consentRepository . deleteConsentDecision ( decisionId , principal ) ; }
Revoke consents .
18,186
public void setValues ( final Set < String > values ) { getValues ( ) . clear ( ) ; if ( values == null ) { return ; } getValues ( ) . addAll ( values ) ; }
Sets values .
18,187
public static Map < String , List < Object > > convertAttributeValuesToMultiValuedObjects ( final Map < String , Object > attributes ) { val entries = attributes . entrySet ( ) ; return entries . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , entry -> { val value = entry . getValue ( ) ; return Col...
Convert attribute values to multi valued objects .
18,188
public static Map < String , List < Object > > retrieveAttributesFromAttributeRepository ( final IPersonAttributeDao attributeRepository , final String principalId , final Set < String > activeAttributeRepositoryIdentifiers ) { var filter = IPersonAttributeDaoFilter . alwaysChoose ( ) ; if ( activeAttributeRepositoryId...
Retrieve attributes from attribute repository and return map .
18,189
public static IAttributeMerger getAttributeMerger ( final String mergingPolicy ) { switch ( mergingPolicy . toLowerCase ( ) ) { case "multivalued" : case "multi_valued" : case "combine" : return new MultivaluedAttributeMerger ( ) ; case "add" : return new NoncollidingAttributeAdder ( ) ; case "replace" : case "overwrit...
Gets attribute merger .
18,190
public static Map < String , List < Object > > mergeAttributes ( final Map < String , List < Object > > currentAttributes , final Map < String , List < Object > > attributesToMerge ) { val merger = new MultivaluedAttributeMerger ( ) ; val toModify = currentAttributes . entrySet ( ) . stream ( ) . map ( entry -> Pair . ...
Merge attributes map .
18,191
public static Map < String , Object > transformPrincipalAttributesListIntoMap ( final List < String > list ) { val map = transformPrincipalAttributesListIntoMultiMap ( list ) ; return CollectionUtils . wrap ( map ) ; }
Transform principal attributes list into map map .
18,192
public static Predicate < Credential > newCredentialSelectionPredicate ( final String selectionCriteria ) { try { if ( StringUtils . isBlank ( selectionCriteria ) ) { return credential -> true ; } if ( selectionCriteria . endsWith ( ".groovy" ) ) { val loader = new DefaultResourceLoader ( ) ; val resource = loader . ge...
Gets credential selection predicate .
18,193
public static AuthenticationPasswordPolicyHandlingStrategy newPasswordPolicyHandlingStrategy ( final PasswordPolicyProperties properties ) { if ( properties . getStrategy ( ) == PasswordPolicyProperties . PasswordPolicyHandlingOptions . REJECT_RESULT_CODE ) { LOGGER . debug ( "Created password policy handling strategy ...
New password policy handling strategy .
18,194
public static PrincipalResolver newPersonDirectoryPrincipalResolver ( final PrincipalFactory principalFactory , final IPersonAttributeDao attributeRepository , final PersonDirectoryPrincipalResolverProperties personDirectory ) { return new PersonDirectoryPrincipalResolver ( attributeRepository , principalFactory , pers...
New person directory principal resolver .
18,195
public HazelcastInstance hazelcastInstance ( ) { val hzConfigResource = casProperties . getWebflow ( ) . getSession ( ) . getHzLocation ( ) ; val configUrl = hzConfigResource . getURL ( ) ; val config = new XmlConfigBuilder ( hzConfigResource . getInputStream ( ) ) . build ( ) ; config . setConfigurationUrl ( configUrl...
Hazelcast instance that is used by the spring session repository to broadcast session events . The name of this bean must be left untouched .
18,196
public void putPasswordResetToken ( final RequestContext requestContext , final String token ) { val flowScope = requestContext . getFlowScope ( ) ; flowScope . put ( FLOWSCOPE_PARAMETER_NAME_TOKEN , token ) ; }
Put password reset token .
18,197
public void putPasswordResetSecurityQuestions ( final RequestContext requestContext , final List < String > value ) { val flowScope = requestContext . getFlowScope ( ) ; flowScope . put ( "questions" , value ) ; }
Put password reset security questions .
18,198
public static List < String > getPasswordResetQuestions ( final RequestContext requestContext ) { val flowScope = requestContext . getFlowScope ( ) ; return flowScope . get ( "questions" , List . class ) ; }
Gets password reset questions .
18,199
public static void putPasswordResetSecurityQuestionsEnabled ( final RequestContext requestContext , final boolean value ) { val flowScope = requestContext . getFlowScope ( ) ; flowScope . put ( "questionsEnabled" , value ) ; }
Put password reset security questions enabled .