Authentication Policy Contracts in PingFederate define how attributes and claims are processed during the authentication workflow. They act as a blueprint for how data is transformed and exposed to relying parties. In this post, we’ll dive into implementing custom claims and attributes, covering everything from setup to best practices.
What is PingFederate Authentication Policy Contracts?
Authentication Policy Contracts specify the rules for attribute processing during authentication. They determine which attributes are available, how they are mapped, and what claims are issued to relying parties. This flexibility allows organizations to tailor their identity management solutions to specific business needs.
How do you create an Authentication Policy Contract?
Creating an Authentication Policy Contract involves several steps, including defining attributes, setting up attribute mappings, and configuring claim rules.
Step-by-Step Guide
Create a New Contract
Navigate to Policies > Authentication Policy Contracts and click Add. Enter a name and description for your contract.Define Attributes
Go to Attributes tab and add any required attributes. You can source these from various connectors or define them manually.Set Up Attribute Mappings
Under the Attribute Mapping tab, map the source attributes to the contract attributes. Ensure all necessary mappings are correctly configured.Configure Claim Rules
Switch to the Claim Rules tab and define how claims are generated. Use the rule editor to specify conditions and transformations.Activate the Contract
Once everything is configured, activate the contract by clicking Activate.How do you implement custom claims in PingFederate?
Implementing custom claims involves defining new claims in your Authentication Policy Contract and specifying how they are generated.
Quick Answer
To implement custom claims:
- Create a new Authentication Policy Contract.
- Define the custom claims in the Claim Rules tab.
- Map the necessary attributes and configure the claim generation logic.
Example: Adding a Custom Claim
Let’s say you want to add a custom claim called employeeId to your authentication tokens.
Create a New Contract: Navigate to Policies > Authentication Policy Contracts and add a new contract named
EmployeeContract.Define Attributes: Go to the Attributes tab and add an attribute named
employeeId. Set its source to your user store.Set Up Attribute Mappings: Under the Attribute Mapping tab, map the
employeeIdattribute from your user store to the contract attribute.Configure Claim Rules: Switch to the Claim Rules tab and add a new rule. Use the following rule to generate the
employeeIdclaim:Rule Name: Generate Employee ID Claim Condition: True Action: Issue Claim Claim Type: employeeId Claim Value: ${employeeId}Activate the Contract: Save and activate the contract.
Common Pitfalls
- Incorrect Attribute Mapping: Ensure that the attribute names match exactly between your user store and the contract.
- Invalid Claim Rules: Double-check the syntax and logic of your claim rules to avoid errors.
How do you handle sensitive attributes in PingFederate?
Handling sensitive attributes requires careful consideration to ensure data security and compliance.
Best Practices
- Encrypt Sensitive Data: Ensure that sensitive attributes are encrypted both in transit and at rest.
- Limit Exposure: Only expose necessary attributes to relying parties. Avoid sending sensitive information unless absolutely required.
- Validate Inputs: Validate all inputs to prevent injection attacks and other vulnerabilities.
Example: Encrypting Sensitive Attributes
To encrypt a sensitive attribute like socialSecurityNumber, follow these steps:
Enable Encryption: Navigate to System > System Configuration > Encryption and enable encryption for sensitive attributes.
Configure Attribute Encryption: Go to the Attributes tab of your contract and mark
socialSecurityNumberas encrypted.Test Encryption: Perform a test authentication to ensure that the attribute is correctly encrypted.
How do you troubleshoot issues with Authentication Policy Contracts?
Troubleshooting issues with Authentication Policy Contracts often involves checking configurations and logs.
Common Issues
- Attribute Not Found: Verify that the attribute exists in your user store and is correctly mapped in the contract.
- Claim Rule Errors: Check the syntax and logic of your claim rules for any mistakes.
- Activation Failures: Ensure all required fields are filled out and configurations are valid.
Example: Troubleshooting Attribute Mapping
If you encounter an error stating that an attribute is not found, follow these steps:
- Check User Store: Verify that the attribute exists in your user store.
- Review Mappings: Ensure that the attribute is correctly mapped in the contract.
- Test Authentication: Perform a test authentication to see if the issue persists.
How do you optimize performance with Authentication Policy Contracts?
Optimizing performance involves minimizing unnecessary processing and ensuring efficient data handling.
Tips for Optimization
- Minimize Attributes: Only include necessary attributes in your contracts to reduce processing time.
- Cache Results: Use caching to store frequently accessed data, reducing the need for repeated queries.
- Profile Performance: Use PingFederate’s profiling tools to identify bottlenecks and optimize accordingly.
Example: Caching Attributes
To cache an attribute like department, follow these steps:
Enable Caching: Navigate to System > System Configuration > Caching and enable caching for the attribute.
Configure Cache Settings: Set the cache duration and eviction policies based on your requirements.
Test Caching: Perform a test authentication to ensure that the attribute is correctly cached.
Comparison of Different Claim Generation Approaches
| Approach | Pros | Cons | Use When |
|---|---|---|---|
| Static Values | Simple to set up | Lack flexibility | Fixed values required |
| Dynamic Values | Flexible and dynamic | More complex to configure | Data varies based on context |
| Conditional Logic | Advanced control | Requires thorough testing | Conditional claims needed |
Quick Reference
📋 Quick Reference
Policies > Authentication Policy Contracts- Navigate to contractsAttributes- Define contract attributesAttribute Mapping- Map source attributes to contract attributesClaim Rules- Configure claim generation logic
Key Takeaways
🎯 Key Takeaways
- Authentication Policy Contracts define attribute and claim processing in PingFederate.
- Custom claims are implemented by configuring attribute mappings and claim rules.
- Handle sensitive attributes carefully to ensure data security and compliance.
- Troubleshoot issues by checking configurations and logs.
- Optimize performance by minimizing attributes and using caching.
Start implementing custom claims and attributes in PingFederate today. With these guidelines, you’ll be able to tailor your identity management solution to meet your specific needs while maintaining security and performance.

