Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 877022 Details for
Bug 1034815
Authentication/Authorization fails with RESTEasy component
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Diff from make-mead
BZ01056610.Patch.diff (text/plain), 8.57 KB, created by
Rick Wagner
on 2014-03-20 20:27:35 UTC
(
hide
)
Description:
Diff from make-mead
Filename:
MIME Type:
Creator:
Rick Wagner
Created:
2014-03-20 20:27:35 UTC
Size:
8.57 KB
patch
obsolete
>37a38 >> import org.switchyard.security.context.SecurityContextManager; >51a53 >> private SecurityContextManager _securityContextManager; >62a65 >> _securityContextManager = new SecurityContextManager(_domain); >105a109,110 >> _securityContextManager.addCredentials(exchange, restMessageRequest.extractCredentials()); >> >124c129 >< throw new WebApplicationException(e); >--- >> throw new WebApplicationException(e); >147a153 >> >2,13c2,13 >< * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors. >< * >< * Licensed under the Apache License, Version 2.0 (the "License"); >< * you may not use this file except in compliance with the License. >< * You may obtain a copy of the License at >< * http://www.apache.org/licenses/LICENSE-2.0 >< * Unless required by applicable law or agreed to in writing, software >< * distributed under the License is distributed on an "AS IS" BASIS, >< * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >< * See the License for the specific language governing permissions and >< * limitations under the License. >< */ >--- >> * * Copyright 2013 Red Hat Inc. and/or its affiliates and other contributors. >> * * >> * * Licensed under the Apache License, Version 2.0 (the "License"); >> * * you may not use this file except in compliance with the License. >> * * You may obtain a copy of the License at >> * * http://www.apache.org/licenses/LICENSE-2.0 >> * * Unless required by applicable law or agreed to in writing, software >> * * distributed under the License is distributed on an "AS IS" BASIS, >> * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. >> * * See the License for the specific language governing permissions and >> * * limitations under the License. >> * */ >15a16 >> import java.security.Principal; >16a18 >> import java.util.HashSet; >17a20 >> import java.util.Set; >22c25,30 >< import org.switchyard.component.common.composer.BindingData; >--- >> import org.switchyard.common.lang.Strings; >> import org.switchyard.component.common.composer.SecurityBindingData; >> import org.switchyard.security.credential.ConfidentialityCredential; >> import org.switchyard.security.credential.Credential; >> import org.switchyard.security.credential.PrincipalCredential; >> import org.switchyard.security.credential.extractor.AuthorizationHeaderCredentialExtractor; >25,29c33,37 >< * Wrapper for RESTEasy messages. >< * >< * @author Magesh Kumar B <mageshbk@jboss.com> © 2012 Red Hat Inc. >< */ >< public class RESTEasyBindingData implements BindingData { >--- >> * * Wrapper for RESTEasy messages. >> * * >> * * @author Magesh Kumar B <mageshbk@jboss.com> © 2012 Red Hat Inc. >> * */ >> public class RESTEasyBindingData implements SecurityBindingData { >33a42,43 >> private Boolean _secured = false; >> private Principal _principal; >36,37c46,47 >< * Creates a new RESTEasy message. >< */ >--- >> * * Creates a new RESTEasy message. >> * */ >41,43c51,53 >< * Creates a new RESTEasy message, given the specified content. >< * @param content the specified content >< */ >--- >> * * Creates a new RESTEasy message, given the specified content. >> * * @param content the specified content >> * */ >49,51c59,61 >< * Gets the operation name to be invoked. >< * @return the operations name >< */ >--- >> * * Gets the operation name to be invoked. >> * * @return the operations name >> * */ >57,59c67,69 >< * Sets the operation name to be invoked. >< * @param operationName the operations name >< */ >--- >> * * Sets the operation name to be invoked. >> * * @param operationName the operations name >> * */ >65,67c75,77 >< * Gets the method parameters as passed from RESTEasy. >< * @return the method parameters >< */ >--- >> * * Gets the method parameters as passed from RESTEasy. >> * * @return the method parameters >> * */ >73,75c83,85 >< * Sets the method parameters. >< * @param args the method parameters >< */ >--- >> * * Sets the method parameters. >> * * @param args the method parameters >> * */ >83,85c93,95 >< * Get the HTTP headers map. >< * @return a Map of headers >< */ >--- >> * * Get the HTTP headers map. >> * * @return a Map of headers >> * */ >94,96c104,106 >< * Set the HTTP headers map. >< * @param headers a Map of headers >< */ >--- >> * * Set the HTTP headers map. >> * * @param headers a Map of headers >> * */ >102,105c112,115 >< * Add a HTTP header. >< * @param name the name of the header >< * @param values a List of header values >< */ >--- >> * * Add a HTTP header. >> * * @param name the name of the header >> * * @param values a List of header values >> * */ >114,117c124,127 >< * Add a HTTP header. >< * @param name the name of the header >< * @param value a header value >< */ >--- >> * * Add a HTTP header. >> * * @param name the name of the header >> * * @param value a header value >> * */ >131,133c141,143 >< * Gets the HTTP response status code. >< * @return the response status code >< */ >--- >> * * Gets the HTTP response status code. >> * * @return the response status code >> * */ >139,141c149,151 >< * Sets the HTTP response status code. >< * @param statusCode the response status code >< */ >--- >> * * Sets the HTTP response status code. >> * * @param statusCode the response status code >> * */ >144a155,223 >> >> /** >> * * Returns a boolean stating if this request was made using a secure channel. >> * * @return the true if secure, false otherwise >> * */ >> public Boolean isSecured() { >> return _secured; >> } >> >> /** >> * * Sets, the boolean, if this request was made through a secure channel or not. >> * * @param secured the boolean to set >> * */ >> public void setSecured(Boolean secured) { >> _secured = secured; >> } >> >> /** >> * * Gets the User Principal associated with this request. >> * * @return the Principal >> * */ >> public Principal getPrincipal() { >> return _principal; >> } >> >> /** >> * * Sets the User Principal associated with this request. >> * * @param principal the Principal to set >> * */ >> public void setPrincipal(Principal principal) { >> _principal = principal; >> } >> >> /** >> * * {@inheritDoc} >> * */ >> @Override >> public Set<Credential> extractCredentials() { >> Set<Credential> credentials = new HashSet<Credential>(); >> String charsetName = null; >> List<String> contentTypes = _headers.get("content-type"); >> String contentType = null; >> if ((contentTypes != null) && (contentTypes.size() > 0)) { >> contentType = contentTypes.get(0); >> } >> if (contentType != null) { >> int pos = contentType.lastIndexOf("charset="); >> if (pos > -1) { >> charsetName = Strings.trimToNull(contentType.substring(pos+8, contentType.length())); >> } >> } >> List<String> authorizations = _headers.get("authorization"); >> if ((authorizations != null) && (authorizations.size() > 0)) { >> AuthorizationHeaderCredentialExtractor ahce; >> if (charsetName != null) { >> ahce = new AuthorizationHeaderCredentialExtractor(charsetName); >> } else { >> ahce = new AuthorizationHeaderCredentialExtractor(); >> } >> credentials.addAll(ahce.extract(authorizations.get(0))); >> } >> if (_principal != null) { >> credentials.add(new PrincipalCredential(_principal, true)); >> } >> if (_secured) { >> credentials.add(new ConfidentialityCredential(true)); >> } >> return credentials; >> } >24a25 >> import javax.ws.rs.core.SecurityContext; >86a88,92 >> SecurityContext securityContext = ResteasyProviderFactory.getContextData(SecurityContext.class); >> if (securityContext != null) { >> requestData.setSecured(securityContext.isSecure()); >> requestData.setPrincipal(securityContext.getUserPrincipal()); >> } >146a153 >>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1034815
: 877022 |
877023
|
877024