idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
18,200
public static void putPasswordResetUsername ( final RequestContext requestContext , final String username ) { val flowScope = requestContext . getFlowScope ( ) ; flowScope . put ( "username" , username ) ; }
Put password reset username .
18,201
public static String getPasswordResetUsername ( final RequestContext requestContext ) { val flowScope = requestContext . getFlowScope ( ) ; return flowScope . getString ( "username" ) ; }
Gets password reset username .
18,202
public static String getPasswordResetToken ( final RequestContext requestContext ) { val flowScope = requestContext . getFlowScope ( ) ; return flowScope . getString ( FLOWSCOPE_PARAMETER_NAME_TOKEN ) ; }
Gets password reset token .
18,203
public static String putPasswordResetPasswordPolicyPattern ( final RequestContext requestContext , final String policyPattern ) { val flowScope = requestContext . getFlowScope ( ) ; return flowScope . getString ( "policyPattern" ) ; }
Put password reset password policy pattern string .
18,204
private static boolean containsAddress ( final InetAddress network , final InetAddress netmask , final InetAddress ip ) { LOGGER . debug ( "Checking IP address: [{}] in [{}] by [{}]" , ip , network , netmask ) ; val networkBytes = network . getAddress ( ) ; val netmaskBytes = netmask . getAddress ( ) ; val ipBytes = ip...
Checks if a subnet contains a specific IP address .
18,205
public void configureIpNetworkRange ( final String ipAddressRange ) { if ( StringUtils . isNotBlank ( ipAddressRange ) ) { val splitAddress = Splitter . on ( "/" ) . splitToList ( ipAddressRange ) ; if ( splitAddress . size ( ) == 2 ) { val network = splitAddress . get ( 0 ) . trim ( ) ; val netmask = splitAddress . ge...
Sets ip network range .
18,206
protected ModelAndView buildCallbackUrlResponseType ( final AccessTokenRequestDataHolder holder , final String redirectUri , final AccessToken accessToken , final List < NameValuePair > params , final RefreshToken refreshToken , final J2EContext context ) throws Exception { val attributes = holder . getAuthentication (...
Build callback url response type string .
18,207
public Event doExecute ( final RequestContext requestContext ) { val tgtId = WebUtils . getTicketGrantingTicketId ( requestContext ) ; if ( StringUtils . isBlank ( tgtId ) ) { return new Event ( this , CasWebflowConstants . TRANSITION_ID_TGT_NOT_EXISTS ) ; } try { val ticket = this . centralAuthenticationService . getT...
Determines whether the TGT in the flow request context is valid .
18,208
private static boolean isCritical ( final X509Certificate certificate , final String extensionOid ) { val criticalOids = certificate . getCriticalExtensionOIDs ( ) ; if ( criticalOids == null || criticalOids . isEmpty ( ) ) { return false ; } return criticalOids . contains ( extensionOid ) ; }
Checks if critical extension oids contain the extension oid .
18,209
private static boolean doesNameMatchPattern ( final Principal principal , final Pattern pattern ) { if ( pattern != null ) { val name = principal . getName ( ) ; val result = pattern . matcher ( name ) . matches ( ) ; LOGGER . debug ( "[{}] matches [{}] == [{}]" , pattern . pattern ( ) , name , result ) ; return result...
Does principal name match pattern?
18,210
private void validate ( final X509Certificate cert ) throws GeneralSecurityException { cert . checkValidity ( ) ; this . revocationChecker . check ( cert ) ; val pathLength = cert . getBasicConstraints ( ) ; if ( pathLength < 0 ) { if ( ! isCertificateAllowed ( cert ) ) { throw new FailedLoginException ( "Certificate s...
Validate the X509Certificate received .
18,211
public void handleCasRegisteredServiceLoadedEvent ( final CasRegisteredServiceLoadedEvent event ) { LOGGER . trace ( "Received event [{}]" , event ) ; this . publisher . publish ( event . getRegisteredService ( ) , event ) ; }
Handle cas registered service loaded event .
18,212
public void handleCasRegisteredServiceSavedEvent ( final CasRegisteredServiceSavedEvent event ) { LOGGER . trace ( "Received event [{}]" , event ) ; this . publisher . publish ( event . getRegisteredService ( ) , event ) ; }
Handle cas registered service saved event .
18,213
public void handleCasRegisteredServiceDeletedEvent ( final CasRegisteredServiceDeletedEvent event ) { LOGGER . trace ( "Received event [{}]" , event ) ; this . publisher . publish ( event . getRegisteredService ( ) , event ) ; }
Handle cas registered service deleted event .
18,214
public void handleConfigurationModifiedEvent ( final CasConfigurationModifiedEvent event ) { if ( this . contextRefresher == null ) { LOGGER . warn ( "Unable to refresh application context, since no refresher is available" ) ; return ; } if ( event . isEligibleForContextRefresh ( ) ) { LOGGER . info ( "Received event [...
Handle configuration modified event .
18,215
protected void configureEncryptionKeyFromPublicKeyResource ( final String secretKeyToUse ) { val object = extractPublicKeyFromResource ( secretKeyToUse ) ; LOGGER . debug ( "Located encryption key resource [{}]" , secretKeyToUse ) ; setSecretKeyEncryptionKey ( object ) ; setEncryptionAlgorithm ( KeyManagementAlgorithmI...
Configure encryption key from public key resource .
18,216
protected Map < String , List < Object > > getUserInfoFromIndexResult ( final ListIndexResult indexResult ) { val attachment = indexResult . getIndexAttachments ( ) . stream ( ) . findFirst ( ) . orElse ( null ) ; if ( attachment == null ) { LOGGER . warn ( "Index result has no attachments" ) ; return null ; } val iden...
Gets user info from index result .
18,217
private static String getRelativeRedirectUrlFor ( final WsFederationConfiguration config , final Service service , final HttpServletRequest request ) { val builder = new URIBuilder ( WsFederationNavigationController . ENDPOINT_REDIRECT ) ; builder . addParameter ( WsFederationNavigationController . PARAMETER_NAME , con...
Gets redirect url for .
18,218
public Event buildAuthenticationRequestEvent ( final RequestContext context ) { val clients = new ArrayList < WsFedClient > ( ) ; val request = WebUtils . getHttpServletRequestFromExternalWebflowContext ( context ) ; val service = ( Service ) context . getFlowScope ( ) . get ( CasProtocolConstants . PARAMETER_SERVICE )...
Build authentication request event event .
18,219
public < T > T execute ( final String methodName , final Class < T > clazz , final Object ... args ) { return execute ( methodName , clazz , true , args ) ; }
Execute t .
18,220
protected String getRemoteHostName ( final String remoteIp ) { val revDNS = new ReverseDNSRunnable ( remoteIp ) ; val t = new Thread ( revDNS ) ; t . start ( ) ; try { t . join ( this . timeout ) ; } catch ( final InterruptedException e ) { LOGGER . debug ( "Threaded lookup failed. Defaulting to IP [{}]." , remoteIp ,...
Convenience method to perform a reverse DNS lookup . Threads the request through a custom Runnable class in order to prevent inordinately long user waits while performing reverse lookup .
18,221
private static SignatureTrustEngine buildSignatureTrustEngine ( final WsFederationConfiguration wsFederationConfiguration ) { val signingWallet = wsFederationConfiguration . getSigningWallet ( ) ; LOGGER . debug ( "Building signature trust engine based on the following signing certificates:" ) ; signingWallet . forEach...
Build signature trust engine .
18,222
private static Credential getEncryptionCredential ( final WsFederationConfiguration config ) { LOGGER . debug ( "Locating encryption credential private key [{}]" , config . getEncryptionPrivateKey ( ) ) ; val br = new BufferedReader ( new InputStreamReader ( config . getEncryptionPrivateKey ( ) . getInputStream ( ) , S...
Gets encryption credential . The encryption private key will need to contain the private keypair in PEM format . The encryption certificate is shared with ADFS in DER format i . e certificate . crt .
18,223
public WsFederationCredential createCredentialFromToken ( final Assertion assertion ) { val retrievedOn = ZonedDateTime . now ( ZoneOffset . UTC ) ; LOGGER . debug ( "Retrieved on [{}]" , retrievedOn ) ; val credential = new WsFederationCredential ( ) ; credential . setRetrievedOn ( retrievedOn ) ; credential . setId (...
createCredentialFromToken converts a SAML 1 . 1 assertion to a WSFederationCredential .
18,224
public RequestedSecurityToken getRequestSecurityTokenFromResult ( final String wresult ) { LOGGER . debug ( "Result token received from ADFS is [{}]" , wresult ) ; try ( InputStream in = new ByteArrayInputStream ( wresult . getBytes ( StandardCharsets . UTF_8 ) ) ) { LOGGER . debug ( "Parsing token into a document" ) ;...
Gets request security token response from result .
18,225
public Pair < Assertion , WsFederationConfiguration > buildAndVerifyAssertion ( final RequestedSecurityToken reqToken , final Collection < WsFederationConfiguration > config ) { val securityToken = getSecurityTokenFromRequestedToken ( reqToken , config ) ; if ( securityToken instanceof Assertion ) { LOGGER . debug ( "S...
converts a token into an assertion .
18,226
public boolean validateSignature ( final Pair < Assertion , WsFederationConfiguration > resultPair ) { if ( resultPair == null ) { LOGGER . warn ( "No assertion or its configuration was provided to validate signatures" ) ; return false ; } val configuration = resultPair . getValue ( ) ; val assertion = resultPair . get...
validateSignature checks to see if the signature on an assertion is valid .
18,227
public String getRelyingPartyIdentifier ( final Service service , final WsFederationConfiguration configuration ) { val relyingPartyIdentifier = configuration . getRelyingPartyIdentifier ( ) ; if ( service != null ) { val registeredService = this . servicesManager . findServiceBy ( service ) ; RegisteredServiceAccessSt...
Get the relying party id for a service .
18,228
private static Credential getSigningCredential ( final Resource resource ) { try ( val inputStream = resource . getInputStream ( ) ) { val certificateFactory = CertificateFactory . getInstance ( "X.509" ) ; val certificate = ( X509Certificate ) certificateFactory . generateCertificate ( inputStream ) ; val publicCreden...
getSigningCredential loads up an X509Credential from a file .
18,229
public String getAuthorizationUrl ( final String relyingPartyIdentifier , final String wctx ) { return String . format ( getIdentityProviderUrl ( ) + QUERYSTRING , relyingPartyIdentifier , wctx ) ; }
Gets authorization url .
18,230
protected String getRenderedUserProfile ( final Map < String , Object > model ) { if ( oauthProperties . getUserProfileViewType ( ) == OAuthProperties . UserProfileViewTypes . FLAT ) { val flattened = new LinkedHashMap < String , Object > ( ) ; if ( model . containsKey ( MODEL_ATTRIBUTE_ATTRIBUTES ) ) { val attributes ...
Gets rendered user profile .
18,231
public static Map < String , Object > buildEventAttributeMap ( final Principal principal , final Optional < RegisteredService > service , final MultifactorAuthenticationProvider provider ) { val map = new HashMap < String , Object > ( ) ; map . put ( Principal . class . getName ( ) , principal ) ; service . ifPresent (...
Build event attribute map map .
18,232
public static Event validateEventIdForMatchingTransitionInContext ( final String eventId , final Optional < RequestContext > context , final Map < String , Object > attributes ) { val attributesMap = new LocalAttributeMap < Object > ( attributes ) ; val event = new Event ( eventId , eventId , attributesMap ) ; return c...
Validate event id for matching transition in context event .
18,233
public static Set < Event > resolveEventViaMultivaluedAttribute ( final Principal principal , final Object attributeValue , final RegisteredService service , final Optional < RequestContext > context , final MultifactorAuthenticationProvider provider , final Predicate < String > predicate ) { val events = new HashSet <...
Resolve event via multivalued attribute set .
18,234
public static Set < Event > resolveEventViaSingleAttribute ( final Principal principal , final Object attributeValue , final RegisteredService service , final Optional < RequestContext > context , final MultifactorAuthenticationProvider provider , final Predicate < String > predicate ) { if ( ! ( attributeValue instanc...
Resolve event via single attribute set .
18,235
public Collection < MultifactorAuthenticationProvider > getAuthenticationProviderForService ( final RegisteredService service ) { val policy = service . getMultifactorPolicy ( ) ; if ( policy != null ) { return policy . getMultifactorAuthenticationProviders ( ) . stream ( ) . map ( MultifactorAuthenticationUtils :: get...
Gets authentication provider for service .
18,236
public static Set < Event > evaluateEventForProviderInContext ( final Principal principal , final RegisteredService service , final Optional < RequestContext > context , final MultifactorAuthenticationProvider provider ) { LOGGER . debug ( "Attempting check for availability of multifactor authentication provider [{}] f...
Evaluate event for provider in context set .
18,237
public static Map < String , MultifactorAuthenticationProvider > getAvailableMultifactorAuthenticationProviders ( final ApplicationContext applicationContext ) { try { return applicationContext . getBeansOfType ( MultifactorAuthenticationProvider . class , false , true ) ; } catch ( final Exception e ) { LOGGER . trace...
Gets all multifactor authentication providers from application context .
18,238
protected String determineConsentEvent ( final RequestContext requestContext ) { val webService = WebUtils . getService ( requestContext ) ; val service = this . authenticationRequestServiceSelectionStrategies . resolveService ( webService ) ; if ( service == null ) { return null ; } val registeredService = getRegister...
Determine consent event string .
18,239
protected String isConsentRequired ( final Service service , final RegisteredService registeredService , final Authentication authentication , final RequestContext requestContext ) { val required = this . consentEngine . isConsentRequiredFor ( service , registeredService , authentication ) . isRequired ( ) ; return req...
Is consent required ?
18,240
public String getDescription ( ) { val items = getDescriptions ( ) ; if ( items . isEmpty ( ) ) { return this . registeredService . getDescription ( ) ; } return StringUtils . collectionToDelimitedString ( items , "." ) ; }
Gets description .
18,241
public String getDisplayName ( ) { val items = getDisplayNames ( ) ; if ( items . isEmpty ( ) ) { return this . registeredService . getName ( ) ; } return StringUtils . collectionToDelimitedString ( items , "." ) ; }
Gets display name .
18,242
public String getInformationURL ( ) { val items = getInformationURLs ( ) ; if ( items . isEmpty ( ) ) { return this . registeredService . getInformationUrl ( ) ; } return StringUtils . collectionToDelimitedString ( items , "." ) ; }
Gets information uRL .
18,243
public String getPrivacyStatementURL ( ) { val items = getPrivacyStatementURLs ( ) ; if ( items . isEmpty ( ) ) { return this . registeredService . getPrivacyUrl ( ) ; } return StringUtils . collectionToDelimitedString ( items , "." ) ; }
Gets privacy statement uRL .
18,244
public String getLogoUrl ( ) { try { val items = getLogoUrls ( ) ; if ( ! items . isEmpty ( ) ) { return items . iterator ( ) . next ( ) . getUrl ( ) ; } } catch ( final Exception e ) { LOGGER . debug ( e . getMessage ( ) , e ) ; } return this . registeredService . getLogo ( ) ; }
Gets logo url .
18,245
protected String getRegisteredServiceJwtProperty ( final RegisteredService service , final RegisteredServiceProperty . RegisteredServiceProperties propName ) { if ( service == null || ! service . getAccessStrategy ( ) . isServiceAccessAllowed ( ) ) { LOGGER . debug ( "Service is not defined/found or its access is disab...
Gets registered service jwt secret .
18,246
private RegisteredService update ( final RegisteredService rs ) { val currentDn = getCurrentDnForRegisteredService ( rs ) ; if ( StringUtils . isNotBlank ( currentDn ) ) { LOGGER . debug ( "Updating registered service at [{}]" , currentDn ) ; val entry = this . ldapServiceMapper . mapFromRegisteredService ( this . base...
Update the ldap entry with the given registered service .
18,247
public CouchDbGoogleAuthenticatorAccount update ( final OneTimeTokenAccount account ) { setId ( account . getId ( ) ) ; setUsername ( account . getUsername ( ) ) ; setSecretKey ( account . getSecretKey ( ) ) ; setValidationCode ( account . getValidationCode ( ) ) ; setScratchCodes ( account . getScratchCodes ( ) ) ; se...
Update account info from account object .
18,248
private static void putGoogleAnalyticsTrackingIdIntoFlowScope ( final RequestContext context , final String value ) { if ( StringUtils . isBlank ( value ) ) { context . getFlowScope ( ) . remove ( ATTRIBUTE_FLOWSCOPE_GOOGLE_ANALYTICS_TRACKING_ID ) ; } else { context . getFlowScope ( ) . put ( ATTRIBUTE_FLOWSCOPE_GOOGLE...
Put tracking id into flow scope .
18,249
public static StringValueResolver prepScheduledAnnotationBeanPostProcessor ( final ApplicationContext applicationContext ) { val resolver = new CasEmbeddedValueResolver ( applicationContext ) ; try { val sch = applicationContext . getBean ( ScheduledAnnotationBeanPostProcessor . class ) ; sch . setEmbeddedValueResolver...
Gets string value resolver .
18,250
public String build ( final RegisteredService service , final String extension ) { return StringUtils . remove ( service . getName ( ) , ' ' ) + '-' + service . getId ( ) + '.' + extension ; }
Method creates a filename to store the service .
18,251
public void verifySamlProfileRequestIfNeeded ( final RequestAbstractType profileRequest , final MetadataResolver resolver , final HttpServletRequest request , final MessageContext context ) throws Exception { val roleDescriptorResolver = getRoleDescriptorResolver ( resolver , context , profileRequest ) ; LOGGER . debug...
Verify saml profile request if needed .
18,252
public void verifySamlProfileRequestIfNeeded ( final RequestAbstractType profileRequest , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final HttpServletRequest request , final MessageContext context ) throws Exception { verifySamlProfileRequestIfNeeded ( profileRequest , adaptor . getMetadataResol...
Validate authn request signature .
18,253
protected void buildEntityCriteriaForSigningCredential ( final RequestAbstractType profileRequest , final CriteriaSet criteriaSet ) { criteriaSet . add ( new EntityIdCriterion ( SamlIdPUtils . getIssuerFromSamlObject ( profileRequest ) ) ) ; criteriaSet . add ( new EntityRoleCriterion ( SPSSODescriptor . DEFAULT_ELEMEN...
Build entity criteria for signing credential .
18,254
protected SignatureValidationConfiguration getSignatureValidationConfiguration ( ) { val config = DefaultSecurityConfigurationBootstrap . buildDefaultSignatureValidationConfiguration ( ) ; val samlIdp = casProperties . getAuthn ( ) . getSamlIdp ( ) ; if ( this . overrideBlackListedSignatureAlgorithms != null && ! samlI...
Gets signature validation configuration .
18,255
protected TicketDefinition buildTicketDefinition ( final TicketCatalog plan , final String prefix , final Class impl , final int order ) { if ( plan . contains ( prefix ) ) { return plan . find ( prefix ) ; } return new DefaultTicketDefinition ( impl , prefix , order ) ; }
Build ticket ticket definition .
18,256
protected TicketDefinition buildTicketDefinition ( final TicketCatalog plan , final String prefix , final Class impl ) { if ( plan . contains ( prefix ) ) { return plan . find ( prefix ) ; } return new DefaultTicketDefinition ( impl , prefix , Ordered . LOWEST_PRECEDENCE ) ; }
Build ticket definition ticket .
18,257
protected String formatOutputMessageInternal ( final String message ) { try { return EncodingUtils . urlEncode ( message ) ; } catch ( final Exception e ) { LOGGER . warn ( "Unable to encode URL " + message , e ) ; } return message ; }
Encodes the message in UTF - 8 format in preparation to send .
18,258
protected static String cleanupUrl ( final String url ) { if ( url == null ) { return null ; } val jsessionPosition = url . indexOf ( ";jsession" ) ; if ( jsessionPosition == - 1 ) { return url ; } val questionMarkPosition = url . indexOf ( '?' ) ; if ( questionMarkPosition < jsessionPosition ) { return url . substring...
Cleanup the url . Removes jsession ids and query strings .
18,259
protected static String getSourceParameter ( final HttpServletRequest request , final String ... paramNames ) { if ( request != null ) { val parameterMap = request . getParameterMap ( ) ; return Stream . of ( paramNames ) . filter ( p -> parameterMap . containsKey ( p ) || request . getAttribute ( p ) != null ) . findF...
Gets source parameter .
18,260
public ResponseEntity handleWebFingerDiscoveryRequest ( final String resource , final String rel ) { if ( StringUtils . isNotBlank ( rel ) && ! OidcConstants . WEBFINGER_REL . equalsIgnoreCase ( rel ) ) { LOGGER . warn ( "Handling discovery request for a non-standard OIDC relation [{}]" , rel ) ; } val issuer = this . ...
Handle web finger discovery request and produce response entity .
18,261
protected ResponseEntity buildNotFoundResponseEntity ( final String message ) { return new ResponseEntity < > ( CollectionUtils . wrap ( "message" , message ) , HttpStatus . NOT_FOUND ) ; }
Build not found response entity response entity .
18,262
protected UriComponents normalize ( final String resource ) { val builder = UriComponentsBuilder . newInstance ( ) ; val matcher = RESOURCE_NORMALIZED_PATTERN . matcher ( resource ) ; if ( ! matcher . matches ( ) ) { LOGGER . error ( "Unable to match the resource [{}] against pattern [{}] for normalization" , resource ...
Normalize uri components .
18,263
protected boolean isAccessTokenRequest ( final HttpServletRequest request , final HttpServletResponse response ) { val requestPath = request . getRequestURI ( ) ; val pattern = String . format ( "(%s|%s)" , OAuth20Constants . ACCESS_TOKEN_URL , OAuth20Constants . TOKEN_URL ) ; return doesUriMatchPattern ( requestPath ,...
Is access token request request .
18,264
protected boolean isDeviceTokenRequest ( final HttpServletRequest request , final HttpServletResponse response ) { val requestPath = request . getRequestURI ( ) ; val pattern = String . format ( "(%s)" , OAuth20Constants . DEVICE_AUTHZ_URL ) ; return doesUriMatchPattern ( requestPath , pattern ) ; }
Is device token request boolean .
18,265
protected boolean requestRequiresAuthentication ( final HttpServletRequest request , final HttpServletResponse response ) { val accessTokenRequest = isAccessTokenRequest ( request , response ) ; if ( ! accessTokenRequest ) { val extractor = extractAccessTokenGrantRequest ( request ) ; if ( extractor . isPresent ( ) ) {...
Request requires authentication .
18,266
protected boolean isAuthorizationRequest ( final HttpServletRequest request , final HttpServletResponse response ) { val requestPath = request . getRequestURI ( ) ; return doesUriMatchPattern ( requestPath , OAuth20Constants . AUTHORIZE_URL ) ; }
Is authorization request .
18,267
protected boolean doesUriMatchPattern ( final String requestPath , final String patternUrl ) { val pattern = Pattern . compile ( '/' + patternUrl + "(/)*$" ) ; return pattern . matcher ( requestPath ) . find ( ) ; }
Does uri match pattern .
18,268
protected static boolean isLogoutRequestConfirmed ( final RequestContext requestContext ) { val request = WebUtils . getHttpServletRequestFromExternalWebflowContext ( requestContext ) ; return request . getParameterMap ( ) . containsKey ( REQUEST_PARAM_LOGOUT_REQUEST_CONFIRMED ) ; }
Check if the logout must be confirmed .
18,269
protected void destroyApplicationSession ( final HttpServletRequest request , final HttpServletResponse response ) { LOGGER . trace ( "Destroying application session" ) ; val context = new J2EContext ( request , response , new J2ESessionStore ( ) ) ; val manager = new ProfileManager < > ( context , context . getSession...
Destroy application session . Also kills all delegated authn profiles via pac4j .
18,270
protected boolean validateResourceSetScopes ( final ResourceSet rs ) { if ( rs . getPolicies ( ) == null || rs . getPolicies ( ) . isEmpty ( ) ) { return true ; } return rs . getPolicies ( ) . stream ( ) . flatMap ( policy -> policy . getPermissions ( ) . stream ( ) ) . allMatch ( permission -> rs . getScopes ( ) . con...
Validate resource set scopes .
18,271
private String collectEnvironmentInfo ( final Environment environment , final Class < ? > sourceClass ) { val properties = System . getProperties ( ) ; if ( properties . containsKey ( "CAS_BANNER_SKIP" ) ) { try ( val formatter = new Formatter ( ) ) { formatter . format ( "CAS Version: %s%n" , CasVersion . getVersion (...
Collect environment info with details on the java and os deployment versions .
18,272
protected boolean shouldSignTokenFor ( final OidcRegisteredService svc ) { if ( AlgorithmIdentifiers . NONE . equalsIgnoreCase ( svc . getIdTokenSigningAlg ( ) ) ) { LOGGER . warn ( "ID token signing algorithm is set to none for [{}] and ID token will not be signed" , svc . getServiceId ( ) ) ; return false ; } return ...
Should sign token for service?
18,273
protected boolean shouldEncryptTokenFor ( final OidcRegisteredService svc ) { if ( AlgorithmIdentifiers . NONE . equalsIgnoreCase ( svc . getIdTokenEncryptionAlg ( ) ) ) { LOGGER . warn ( "ID token encryption algorithm is set to none for [{}] and ID token will not be encrypted" , svc . getServiceId ( ) ) ; return false...
Should encrypt token for service?
18,274
@ PostMapping ( path = SamlIdPConstants . ENDPOINT_SAML2_SLO_PROFILE_POST ) protected void handleSaml2ProfileSLOPostRequest ( final HttpServletResponse response , final HttpServletRequest request ) throws Exception { val decoder = getSamlProfileHandlerConfigurationContext ( ) . getSamlMessageDecoders ( ) . get ( HttpMe...
Handle SLO POST profile request .
18,275
public static CloudWatchAppender createAppender ( @ PluginAttribute ( "name" ) final String name , @ PluginAttribute ( "awsLogStreamName" ) final String awsLogStreamName , @ PluginAttribute ( "awsLogGroupName" ) final String awsLogGroupName , @ PluginAttribute ( "awsLogStreamFlushPeriodInSeconds" ) final String awsLogS...
Create appender cloud watch appender .
18,276
@ ShellMethod ( key = "add-properties" , value = "Add properties associated with a CAS group/module to a Properties/Yaml configuration file." ) public static void add ( @ ShellOption ( value = { "file" } , help = "Path to the CAS configuration file" , defaultValue = "/etc/cas/config/cas.properties" ) final String file ...
Add properties to configuration .
18,277
public static String getPropertyGroupId ( final ConfigurationMetadataProperty prop ) { if ( isCasProperty ( prop ) ) { return StringUtils . substringBeforeLast ( prop . getName ( ) , "." ) ; } return StringUtils . substringBeforeLast ( prop . getId ( ) , "." ) ; }
Gets property group id .
18,278
protected JwtClaims buildJwtClaims ( final HttpServletRequest request , final AccessToken accessTokenId , final long timeoutInSeconds , final OAuthRegisteredService service , final UserProfile profile , final J2EContext context , final OAuth20ResponseTypes responseType ) { val permissionTicket = ( UmaPermissionTicket )...
Build jwt claims jwt claims .
18,279
private Optional < JsonWebKeySet > buildJsonWebKeySet ( ) { try { LOGGER . debug ( "Loading default JSON web key from [{}]" , this . jwksFile ) ; if ( this . jwksFile != null ) { LOGGER . debug ( "Retrieving default JSON web key from [{}]" , this . jwksFile ) ; val jsonWebKeySet = buildJsonWebKeySet ( this . jwksFile )...
Build json web key set .
18,280
public Map < String , String > getAssociationResponse ( final HttpServletRequest request ) { val parameters = new ParameterList ( request . getParameterMap ( ) ) ; val mode = parameters . hasParameter ( OpenIdProtocolConstants . OPENID_MODE ) ? parameters . getParameterValue ( OpenIdProtocolConstants . OPENID_MODE ) : ...
Gets the association response . Determines the mode first . If mode is set to associate will set the response . Then builds the response parameters next and returns .
18,281
public boolean canPing ( ) { val uidPsw = getClass ( ) . getSimpleName ( ) ; for ( val server : this . servers ) { LOGGER . debug ( "Attempting to ping RADIUS server [{}] via simulating an authentication request. If the server responds " + "successfully, mock authentication will fail correctly." , server ) ; try { serv...
Can ping .
18,282
public static void render ( final Object model , final HttpServletResponse response ) { val jsonConverter = new MappingJackson2HttpMessageConverter ( ) ; jsonConverter . setPrettyPrint ( true ) ; val jsonMimeType = MediaType . APPLICATION_JSON ; jsonConverter . write ( model , jsonMimeType , new ServletServerHttpRespon...
Render model and view .
18,283
public static void render ( final HttpServletResponse response ) { val map = new HashMap < String , Object > ( ) ; response . setStatus ( HttpServletResponse . SC_OK ) ; render ( map , response ) ; }
Render model and view . Sets the response status to OK .
18,284
public static void renderException ( final Exception ex , final HttpServletResponse response ) { val map = new HashMap < String , String > ( ) ; map . put ( "error" , ex . getMessage ( ) ) ; map . put ( "stacktrace" , Arrays . deepToString ( ex . getStackTrace ( ) ) ) ; renderException ( map , response ) ; }
Render exceptions . Adds error messages and the stack trace to the json model and sets the response status accordingly to note bad requests .
18,285
private static void renderException ( final Map model , final HttpServletResponse response ) { response . setStatus ( HttpServletResponse . SC_BAD_REQUEST ) ; model . put ( "status" , HttpServletResponse . SC_BAD_REQUEST ) ; render ( model , response ) ; }
Render exceptions . Sets the response status accordingly to note bad requests .
18,286
public ResponseEntity < SimplePrincipal > authenticate ( final UsernamePasswordCredential c ) { val entity = new HttpEntity < Object > ( HttpUtils . createBasicAuthHeaders ( c . getUsername ( ) , c . getPassword ( ) ) ) ; return restTemplate . exchange ( authenticationUri , HttpMethod . POST , entity , SimplePrincipal ...
Authenticate and receive entity from the rest template .
18,287
protected AuthenticationRiskContingencyResponse executeInternal ( final Authentication authentication , final RegisteredService service , final AuthenticationRiskScore score , final HttpServletRequest request ) { return null ; }
Execute authentication risk contingency plan .
18,288
public DefaultTicketFactory addTicketFactory ( final Class < ? extends Ticket > ticketClass , final TicketFactory factory ) { this . factoryMap . put ( ticketClass . getCanonicalName ( ) , factory ) ; return this ; }
Add ticket factory .
18,289
public void run ( ) { try { LOGGER . debug ( "Attempting to resolve [{}]" , this . ipAddress ) ; val address = InetAddress . getByName ( this . ipAddress ) ; set ( address . getCanonicalHostName ( ) ) ; } catch ( final UnknownHostException e ) { LOGGER . debug ( "Unable to identify the canonical hostname for ip address...
Runnable implementation to thread the work done in this class allowing the implementer to set a thread timeout and thereby short - circuit the lookup .
18,290
protected Response buildSaml2Response ( final Object casAssertion , final RequestAbstractType authnRequest , final SamlRegisteredService service , final SamlRegisteredServiceServiceProviderMetadataFacade adaptor , final HttpServletRequest request , final String binding , final MessageContext messageContext ) { return (...
Build saml2 response .
18,291
protected SecurityToken getSecurityTokenFromRequest ( final HttpServletRequest request ) { val cookieValue = wsFederationRequestConfigurationContext . getTicketGrantingTicketCookieGenerator ( ) . retrieveCookieValue ( request ) ; if ( StringUtils . isNotBlank ( cookieValue ) ) { val tgt = wsFederationRequestConfigurati...
Gets security token from request .
18,292
protected boolean shouldRenewAuthentication ( final WSFederationRequest fedRequest , final HttpServletRequest request ) { if ( StringUtils . isBlank ( fedRequest . getWfresh ( ) ) || NumberUtils . isCreatable ( fedRequest . getWfresh ( ) ) ) { return false ; } val ttl = Long . parseLong ( fedRequest . getWfresh ( ) . t...
Is authentication required?
18,293
@ ExceptionHandler ( Exception . class ) public ModelAndView handleUnauthorizedServiceException ( final HttpServletRequest req , final Exception ex ) { return WebUtils . produceUnauthorizedErrorView ( ) ; }
Handle unauthorized service exception .
18,294
public static < T , R > Function < T , R > doIf ( final Predicate < T > condition , final CheckedFunction < T , R > trueFunction , final CheckedFunction < T , R > falseFunction ) { return t -> { try { if ( condition . test ( t ) ) { return trueFunction . apply ( t ) ; } return falseFunction . apply ( t ) ; } catch ( fi...
Conditional function function .
18,295
public static < R > Supplier < R > doIfNotNull ( final Object input , final Supplier < R > trueFunction , final Supplier < R > falseFunction ) { return ( ) -> { try { if ( input != null ) { return trueFunction . get ( ) ; } return falseFunction . get ( ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ...
Supply if not null supplier .
18,296
public static < T > void doIfNotNull ( final T input , final Consumer < T > trueFunction ) { try { if ( input != null ) { trueFunction . accept ( input ) ; } } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } }
Do if not null .
18,297
public static < T , R > Function < T , R > doAndHandle ( final CheckedFunction < T , R > function , final CheckedFunction < Throwable , R > errorHandler ) { return t -> { try { return function . apply ( t ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; try { return errorHandler . apply ( ...
Default function function .
18,298
public static < R > Supplier < R > doAndHandle ( final Supplier < R > function , final CheckedFunction < Throwable , R > errorHandler ) { return ( ) -> { try { return function . get ( ) ; } catch ( final Throwable e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; try { return errorHandler . apply ( e ) ; } catch ( final...
Do and handle supplier .
18,299
public String build ( final JwtRequest payload ) { val serviceAudience = payload . getServiceAudience ( ) ; val claims = new JWTClaimsSet . Builder ( ) . audience ( serviceAudience ) . issuer ( casSeverPrefix ) . jwtID ( payload . getJwtId ( ) ) . issueTime ( payload . getIssueDate ( ) ) . subject ( payload . getSubjec...
Build JWT .