You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Dave Meier <DM...@SERENA.com> on 2008/02/28 03:41:22 UTC

[AXIS2C and Rampart/C] Question about how to get saml info from inside my service

Hi All,

I have rampart/c set up and working.  I added a policy to accept saml
type info in the Security header.  Everything works and my service is
called.  My question is, how do I get info about the saml stuff from
inside my service?  Is there stuff put into the msg_ctx?  I need to the
saml assertion inside my service code.

Here's my policy:

  <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
    <wsp:ExactlyOne>
      <wsp:All>
        <sp:AsymmetricBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
          <wsp:Policy>
            <sp:InitiatorToken>
              <wsp:Policy>
                <sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/In
cludeToken/AlwaysToRecipient">
                  <wsp:Policy>
                    <sp:WssX509V3Token10/>
                  </wsp:Policy>
                </sp:X509Token>
              </wsp:Policy>
            </sp:InitiatorToken>
            <sp:RecipientToken>
              <wsp:Policy>
                <sp:X509Token
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/In
cludeToken/Never">
                  <wsp:Policy>
                    <sp:WssX509V3Token10/>
                  </wsp:Policy>
                </sp:X509Token>
              </wsp:Policy>
            </sp:RecipientToken>
            <sp:Layout>
              <wsp:Policy>
                <sp:Strict/>
              </wsp:Policy>
            </sp:Layout>
            <sp:IncludeTimestamp/>
          </wsp:Policy>
        </sp:AsymmetricBinding>
        <sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
        <wsp:Policy>
          <sp:IssuedToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/In
cludeToken/AlwaysToRecipient">
            <sp:RequestSecurityTokenTemplate
xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
 
<wst:TokenType>oasis:names:tc:SAML:1.0:assertion</wst:TokenType>
 
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:
RequestType>
            </sp:RequestSecurityTokenTemplate>
          </sp:IssuedToken>
        </wsp:Policy>
        </sp:SignedSupportingTokens>
        <rampc:RampartConfig
xmlns:rampc="http://ws.apache.org/rampart/c/policy">
            <rampc:TimeToLive>360</rampc:TimeToLive>
            <rampc:PasswordType>plainText</rampc:PasswordType>
 
<rampc:AuthnModuleName>F:/TeamTrack701/software/contrib/axis2c/Win32Debu
g/lib/aeaxisauth.dll</rampc:AuthnModuleName>
        </rampc:RampartConfig>
      </wsp:All>
    </wsp:ExactlyOne>
  </wsp:Policy>

Thanks,

-Dave.

**********************************************************************
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message. 
**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org


RE: [AXIS2C and Rampart/C] Question about how to get saml info from inside my service

Posted by Dave Meier <DM...@SERENA.com>.
Thank you, Supun.  This works perfectly!

-Dave. 

-----Original Message-----
From: Supun Kamburugamuva [mailto:supun06@gmail.com] 
Sent: Wednesday, February 27, 2008 8:47 PM
To: rampart-c-dev@ws.apache.org
Subject: Re: [AXIS2C and Rampart/C] Question about how to get saml info
from inside my service

Hi Dave,

At the moment you can get a SAML token from the rampart_context (But
ideally this should be through the processed resluts). Here I have
included how to get the rampart context as well.

    axis2_msg_ctx_t *in_msg_ctx = NULL;
    axis2_op_ctx_t *op_ctx = NULL;
	axutil_property_t *property = NULL;
    rampart_context_t *context = NULL;	
    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
    in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env,
AXIS2_WSDL_MESSAGE_LABEL_IN);

    property = axis2_msg_ctx_get_property(in_msg_ctx, env,
RAMPART_CONTEXT);
    if(property)
    {
        context = (rampart_context_t
*)axutil_property_get_value(property, env);
    }
rampart_saml_token_t *token = rampart_context_get_saml_token(context,
env, RP_PROPERTY_UNKNOWN);
axiom_node_t *assertion = rampart_saml_token_get_assertion(token, env);

Regards,
Supun..


On 2/28/08, Dave Meier <DM...@serena.com> wrote:
> Hi All,
>
>  I have rampart/c set up and working.  I added a policy to accept saml

> type info in the Security header.  Everything works and my service is

> called.  My question is, how do I get info about the saml stuff from  
> inside my service?  Is there stuff put into the msg_ctx?  I need to 
> the  saml assertion inside my service code.
>
>  Here's my policy:
>
>   <wsp:Policy
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>     <wsp:ExactlyOne>
>       <wsp:All>
>         <sp:AsymmetricBinding
>  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>           <wsp:Policy>
>             <sp:InitiatorToken>
>               <wsp:Policy>
>                 <sp:X509Token
>  
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/
> In
>  cludeToken/AlwaysToRecipient">
>                   <wsp:Policy>
>                     <sp:WssX509V3Token10/>
>                   </wsp:Policy>
>                 </sp:X509Token>
>               </wsp:Policy>
>             </sp:InitiatorToken>
>             <sp:RecipientToken>
>               <wsp:Policy>
>                 <sp:X509Token
>  
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/
> In
>  cludeToken/Never">
>                   <wsp:Policy>
>                     <sp:WssX509V3Token10/>
>                   </wsp:Policy>
>                 </sp:X509Token>
>               </wsp:Policy>
>             </sp:RecipientToken>
>             <sp:Layout>
>               <wsp:Policy>
>                 <sp:Strict/>
>               </wsp:Policy>
>             </sp:Layout>
>             <sp:IncludeTimestamp/>
>           </wsp:Policy>
>         </sp:AsymmetricBinding>
>         <sp:SignedSupportingTokens
>  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>         <wsp:Policy>
>           <sp:IssuedToken
>  
> sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/
> In
>  cludeToken/AlwaysToRecipient">
>             <sp:RequestSecurityTokenTemplate  
> xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
>
>  <wst:TokenType>oasis:names:tc:SAML:1.0:assertion</wst:TokenType>
>
>
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:
>  RequestType>
>             </sp:RequestSecurityTokenTemplate>
>           </sp:IssuedToken>
>         </wsp:Policy>
>         </sp:SignedSupportingTokens>
>         <rampc:RampartConfig
>  xmlns:rampc="http://ws.apache.org/rampart/c/policy">
>             <rampc:TimeToLive>360</rampc:TimeToLive>
>             <rampc:PasswordType>plainText</rampc:PasswordType>
>
>  
> <rampc:AuthnModuleName>F:/TeamTrack701/software/contrib/axis2c/Win32De
> bu  g/lib/aeaxisauth.dll</rampc:AuthnModuleName>
>         </rampc:RampartConfig>
>       </wsp:All>
>     </wsp:ExactlyOne>
>   </wsp:Policy>
>
>  Thanks,
>
>  -Dave.
>
>  
> **********************************************************************
>  This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they are
addressed. Any unauthorized review, use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.
>  
> **********************************************************************
>
>

Re: [AXIS2C and Rampart/C] Question about how to get saml info from inside my service

Posted by Supun Kamburugamuva <su...@gmail.com>.
Hi Dave,

At the moment you can get a SAML token from the rampart_context (But
ideally this should be through the processed resluts). Here I have
included how to get the rampart context as well.

    axis2_msg_ctx_t *in_msg_ctx = NULL;
    axis2_op_ctx_t *op_ctx = NULL;
	axutil_property_t *property = NULL;
    rampart_context_t *context = NULL;	
    op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
    in_msg_ctx = axis2_op_ctx_get_msg_ctx(op_ctx, env,
AXIS2_WSDL_MESSAGE_LABEL_IN);

    property = axis2_msg_ctx_get_property(in_msg_ctx, env, RAMPART_CONTEXT);
    if(property)
    {
        context = (rampart_context_t *)axutil_property_get_value(property, env);
    }
rampart_saml_token_t *token = rampart_context_get_saml_token(context,
env, RP_PROPERTY_UNKNOWN);
axiom_node_t *assertion = rampart_saml_token_get_assertion(token, env);

Regards,
Supun..


On 2/28/08, Dave Meier <DM...@serena.com> wrote:
> Hi All,
>
>  I have rampart/c set up and working.  I added a policy to accept saml
>  type info in the Security header.  Everything works and my service is
>  called.  My question is, how do I get info about the saml stuff from
>  inside my service?  Is there stuff put into the msg_ctx?  I need to the
>  saml assertion inside my service code.
>
>  Here's my policy:
>
>   <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
>     <wsp:ExactlyOne>
>       <wsp:All>
>         <sp:AsymmetricBinding
>  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>           <wsp:Policy>
>             <sp:InitiatorToken>
>               <wsp:Policy>
>                 <sp:X509Token
>  sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/In
>  cludeToken/AlwaysToRecipient">
>                   <wsp:Policy>
>                     <sp:WssX509V3Token10/>
>                   </wsp:Policy>
>                 </sp:X509Token>
>               </wsp:Policy>
>             </sp:InitiatorToken>
>             <sp:RecipientToken>
>               <wsp:Policy>
>                 <sp:X509Token
>  sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/In
>  cludeToken/Never">
>                   <wsp:Policy>
>                     <sp:WssX509V3Token10/>
>                   </wsp:Policy>
>                 </sp:X509Token>
>               </wsp:Policy>
>             </sp:RecipientToken>
>             <sp:Layout>
>               <wsp:Policy>
>                 <sp:Strict/>
>               </wsp:Policy>
>             </sp:Layout>
>             <sp:IncludeTimestamp/>
>           </wsp:Policy>
>         </sp:AsymmetricBinding>
>         <sp:SignedSupportingTokens
>  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
>         <wsp:Policy>
>           <sp:IssuedToken
>  sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/In
>  cludeToken/AlwaysToRecipient">
>             <sp:RequestSecurityTokenTemplate
>  xmlns:wst="http://schemas.xmlsoap.org/ws/2005/02/trust">
>
>  <wst:TokenType>oasis:names:tc:SAML:1.0:assertion</wst:TokenType>
>
>  <wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:
>  RequestType>
>             </sp:RequestSecurityTokenTemplate>
>           </sp:IssuedToken>
>         </wsp:Policy>
>         </sp:SignedSupportingTokens>
>         <rampc:RampartConfig
>  xmlns:rampc="http://ws.apache.org/rampart/c/policy">
>             <rampc:TimeToLive>360</rampc:TimeToLive>
>             <rampc:PasswordType>plainText</rampc:PasswordType>
>
>  <rampc:AuthnModuleName>F:/TeamTrack701/software/contrib/axis2c/Win32Debu
>  g/lib/aeaxisauth.dll</rampc:AuthnModuleName>
>         </rampc:RampartConfig>
>       </wsp:All>
>     </wsp:ExactlyOne>
>   </wsp:Policy>
>
>  Thanks,
>
>  -Dave.
>
>  **********************************************************************
>  This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message.
>  **********************************************************************
>
>